Gathering detailed insights and metrics for @graphile/postgis
Gathering detailed insights and metrics for @graphile/postgis
Gathering detailed insights and metrics for @graphile/postgis
Gathering detailed insights and metrics for @graphile/postgis
npm install @graphile/postgis
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
91 Stars
100 Commits
9 Forks
10 Watching
1 Branches
7 Contributors
Updated on 21 Nov 2024
TypeScript (97.99%)
Shell (1.17%)
JavaScript (0.84%)
Cumulative downloads
Total Downloads
Last day
-66.7%
281
Compared to previous day
Last week
-20.1%
1,737
Compared to previous week
Last month
56.4%
6,931
Compared to previous month
Last year
-76%
84,191
Compared to previous year
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.
Work is ongoing, here's the plan:
geojson
field from all geography types (via a shared GraphQL interface)longitude
and latitude
on geography(POINT)
columnsgeometries
in a geography(GEOMETRYCOLLECTION)
longitude
and latitude
) on
geography(LINESTRING)
and geography(POLYGON)
columnsgeography(POINT)
columnsgeography(LINESTRING)
and geography(POLYGON)
columnspostgraphile-plugin-connection-filter
to enable PostGIS specific filtering (via postgraphile-plugin-connection-filter-postgis)geography(LINESTRING)
and geography(POLYGON)
, such as area
,
length
, perimeter
, and centroid
- 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!
This plugin requires PostGraphile v4.4.0 or higher to function correctly.
Add PostGIS to your database:
1CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
Load the plugin:
postgraphile --append-plugins @graphile/postgis
Using this table as example:
1CREATE TABLE data ( 2 id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc(), 3 geom_point geometry(Point, 4326) default null 4);
In queries geom_point
is represented as type GeometryPoint
. Example:
1query { 2 allDatas { 3 nodes { 4 geomPoint { 5 geojson 6 srid 7 x 8 y 9 } 10 } 11 } 12}
In mutations geom_point
is represented as type GeoJSON
. Example:
1mutation ($id: UUID!, $geomPoint: GeoJSON!) { 2 updateDataById( 3 input: { 4 id: $id, 5 dataPatch: { 6 geomPoint: $geomPoint 7 } 8 } 9 ) { ... } 10}
with these variables:
1{ 2 "id": "0116254a-0146-11ea-8418-4f89d6596247", 3 "geomPoint": { 4 "type": "Point", 5 "coordinates": [8.5, 47.5] 6 } 7}
Beware 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.
In earlier versions PostGIS expects a SRID to be passed. So the variables would be:
1{ 2 "id": "0116254a-0146-11ea-8418-4f89d6596247", 3 "geomPoint": { 4 "type": "Point", 5 "coordinates": [8.5, 47.5], 6 "crs": { 7 "type": "name", 8 "properties": { 9 "name": "urn:ogc:def:crs:EPSG::4326" 10 } 11 } 12 } 13}
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
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 4/8 approved changesets -- score normalized to 5
Reason
security policy file detected
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More