README
@graphile/postgis
This is a PostGraphile schema plugin that provides support for the popular PostGIS spatial database system.
Create a PostgreSQL database with PostGIS columns, run PostGraphile with this plugin, and have a fully functional geospatial-aware GraphQL API for your database.
Roadmap
Work is ongoing, here's the plan:
- Read-only support for
geojson
field from all geography types (via a shared GraphQL interface) - Add GraphQL types for all the expected geography types (implementing this interface)
- Read-only support for determining the geometry sub-types of columns and exposing these directly (rather than the interface)
- Read-only support for
longitude
andlatitude
ongeography(POINT)
columns - Read-only support for viewing the list of
geometries
in ageography(GEOMETRYCOLLECTION)
- Read-only support for a list of points (
longitude
andlatitude
) ongeography(LINESTRING)
andgeography(POLYGON)
columns - Create/update/null support for
geography(POINT)
columns - Create/update/null support for
geography(LINESTRING)
andgeography(POLYGON)
columns - Integration with
postgraphile-plugin-connection-filter
to enable PostGIS specific filtering - Read-only support for computed attributes on
geography(LINESTRING)
andgeography(POLYGON)
, such asarea
,length
,perimeter
, andcentroid
- currently possible by adding a plugin and consuming the GeoJSON directly.
There are many, many other features that this plugin could support - if you have specific needs please get in touch!
Usage
This plugin requires PostGraphile v4.4.0-beta.3 or higher to function correctly.
Add PostGIS to your database:
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
Load the plugin:
postgraphile --append-plugins @graphile/postgis
Development
Contributions are extremely welcome! To get started, clone down this repo and then:
createdb graphile_test
export TEST_DATABASE_URL=postgres://localhost:5432/graphile_test
yarn
yarn dev
Note the development server runs at http://localhost:5123/graphiql
To run the tests:
yarn test