{"id":13567870,"url":"https://github.com/graphile/postgis","last_synced_at":"2025-04-07T13:10:25.183Z","repository":{"id":29599658,"uuid":"121959512","full_name":"graphile/postgis","owner":"graphile","description":"PostGIS support for PostGraphile","archived":false,"fork":false,"pushed_at":"2024-09-17T10:36:08.000Z","size":780,"stargazers_count":90,"open_issues_count":8,"forks_count":9,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-10-15T02:31:32.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphile.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-18T14:34:11.000Z","updated_at":"2024-09-17T10:36:11.000Z","dependencies_parsed_at":"2023-01-14T15:30:17.671Z","dependency_job_id":"bc8d9ab0-ae18-4a81-923f-7435306e6acd","html_url":"https://github.com/graphile/postgis","commit_stats":{"total_commits":93,"total_committers":8,"mean_commits":11.625,"dds":0.6451612903225806,"last_synced_commit":"9b947034ac652e6ddfebe75b98f73fc6cc72603f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile%2Fpostgis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile%2Fpostgis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile%2Fpostgis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile%2Fpostgis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphile","download_url":"https://codeload.github.com/graphile/postgis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657282,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:47.224Z","updated_at":"2025-04-07T13:10:25.158Z","avatar_url":"https://github.com/graphile.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","others"],"sub_categories":[],"readme":"# @graphile/postgis\n\nThis is a [PostGraphile schema\nplugin](https://www.graphile.org/postgraphile/extending/) that provides\nsupport for the popular [PostGIS](http://postgis.net/) spatial database\nsystem.\n\nCreate a [PostgreSQL](https://www.postgresql.org/) database with PostGIS\ncolumns, run [PostGraphile](https://www.graphile.org/postgraphile/) with this\nplugin, and have a fully functional geospatial-aware\n[GraphQL](http://graphql.org/) API for your database.\n\n## Roadmap\n\nWork is ongoing, here's the plan:\n\n- [x] Read-only support for `geojson` field from all geography types (via a shared GraphQL interface)\n- [x] Add GraphQL types for all the expected geography types (implementing this interface)\n- [x] Read-only support for determining the geometry sub-types of columns and exposing these directly (rather than the interface)\n- [x] Read-only support for `longitude` and `latitude` on `geography(POINT)` columns\n- [x] Read-only support for viewing the list of `geometries` in a `geography(GEOMETRYCOLLECTION)`\n- [x] Read-only support for a list of points (`longitude` and `latitude`) on\n      `geography(LINESTRING)` and `geography(POLYGON)` columns\n- [x] Create/update/null support for `geography(POINT)` columns\n- [x] Create/update/null support for `geography(LINESTRING)` and `geography(POLYGON)` columns\n- [x] Integration with `postgraphile-plugin-connection-filter` to enable PostGIS specific filtering (via [postgraphile-plugin-connection-filter-postgis](https://github.com/mattbretl/postgraphile-plugin-connection-filter-postgis/))\n- [ ] Read-only support for computed attributes on\n      `geography(LINESTRING)` and `geography(POLYGON)`, such as `area`,\n      `length`, `perimeter`, and `centroid` - currently possible by adding a plugin and consuming the GeoJSON directly.\n\nThere are many, many other features that this plugin could support - if you\nhave specific needs please get in touch!\n\n## Usage\n\nThis plugin requires PostGraphile **v4.4.0** or higher to function correctly.\n\nAdd PostGIS to your database:\n\n```sql\nCREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;\n```\n\nLoad the plugin:\n\n```\npostgraphile --append-plugins @graphile/postgis\n```\n\n#### Querying and mutating\n\nUsing this table as example:\n\n```sql\nCREATE TABLE data (\n  id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc(),\n  geom_point geometry(Point, 4326) default null\n);\n```\n\nIn **queries** `geom_point` is represented as type `GeometryPoint`. Example:\n\n```graphql\nquery {\n  allDatas {\n    nodes {\n      geomPoint {\n        geojson\n        srid\n        x\n        y\n      }\n    }\n  }\n}\n```\n\nIn **mutations** `geom_point` is represented as type `GeoJSON`. Example:\n\n```graphql\nmutation ($id: UUID!, $geomPoint: GeoJSON!) {\n  updateDataById(\n    input: {\n      id: $id,\n      dataPatch: {\n        geomPoint: $geomPoint\n      }\n    }\n  ) { ... }\n}\n```\n\nwith these variables:\n\n```json\n{\n  \"id\": \"0116254a-0146-11ea-8418-4f89d6596247\",\n  \"geomPoint\": {\n    \"type\": \"Point\",\n    \"coordinates\": [8.5, 47.5]\n  }\n}\n```\n\nBeware of the fact that since 2016 the `GeoJSON` spec expects the coordinates to be of SRID 4326/WGS84 (see https://tools.ietf.org/html/rfc7946#section-4). So adding a `crs` field to the GeoJSON is deprecated. Thus since v3 PostGIS will be happy to receive above GeoJSON.\n\n**In earlier versions PostGIS expects a SRID to be passed**. So the variables would be:\n\n```json\n{\n  \"id\": \"0116254a-0146-11ea-8418-4f89d6596247\",\n  \"geomPoint\": {\n    \"type\": \"Point\",\n    \"coordinates\": [8.5, 47.5],\n    \"crs\": {\n      \"type\": \"name\",\n      \"properties\": {\n        \"name\": \"urn:ogc:def:crs:EPSG::4326\"\n      }\n    }\n  }\n}\n```\n\n## Development\n\nContributions are extremely welcome! To get started, clone down this repo and then:\n\n```\ncreatedb graphile_test\nexport TEST_DATABASE_URL=postgres://localhost:5432/graphile_test\nyarn\nyarn dev\n```\n\nNote the development server runs at http://localhost:5123/graphiql\n\nTo run the tests:\n\n```\nyarn test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphile%2Fpostgis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphile%2Fpostgis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphile%2Fpostgis/lists"}