Add logical PostGIS operators support to the plugin
See original GitHub issueThey include the official logical operators (see https://postgis.net/docs/reference.html, section 8.8) and other operators returning a boolean value such as spatial relationships functions (e.g. ST_Disjoint, see section 8.9).
An experimental extension was made in the fork https://github.com/jepetko/postgraphile-plugin-connection-filter/commits/master incl. test setup of the dedicated “postgis” schema alongside the already existing “p” schema.
query {
overlapping: allFilterables(filter: { theGeom: { overlapsBB: "LINESTRING(1 2, 4 6)" } }) { ...filterableConnection }
disjointG: allFilterables(filter: { theGeom: { disjointsG: "LINESTRING(0 5, 4 6)" } }) { ...filterableConnection }
intersectsG: allFilterables(filter: { theGeom: { intersectsG: "LINESTRING(-1 1, 3 1)" } }) { ...filterableConnection }
}
fragment filterableConnection on FilterablesConnection {
pageInfo {
...
}
totalCount
edges {
cursor
node {
id
theGeom
}
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (11 by maintainers)
Top Results From Across the Web
Chapter 8. PostGIS Reference
A type cast converts values of one data type into another type. PostgreSQL allows defining casting behavior for custom types, along with the...
Read more >Chapter 4. Data Management - PostGIS
Functions allow creating geometry objects, accessing or updating all internal fields, and compute new geometry values. PostGIS supports all the functions ...
Read more >Chapter 2. PostGIS Installation
This chapter details the steps required to install PostGIS. ... If you enabled raster support you may want to read below how to...
Read more >Chapter 15. PostGIS Special Functions Index
PostGIS extends the function to support all common geometry types. ... The functions and operators given below are PostGIS functions/operators that take as ......
Read more >Chapter 2. PostGIS Installation
Since raster functions are part of the postgis extension, extension support is not enabled if PostGIS is built without raster. The first step...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI, I just published this: https://github.com/mattbretl/postgraphile-plugin-connection-filter-postgis
Note:
@graphile/postgis
only supports SRID 4326 at the moment, so if you need to use other SRIDs, you still need a custom plugin like the examples above.Sorry for the delay… this fell off my todo list. We still need a PostGIS plugin that does the upfront introspection work necessary to expose the right operators per geometry/geography type.
The approach you shared using
allowedFieldTypes: ['String']
worked through beta.27, but beta.28 checks whether the field is a true string type (text
,varchar
, etc.) before exposing filter operators. As a result, your code won’t work with beta.28. If you (or anyone else) still needs this functionality, the fix is to register a GraphQL input type for the PostGIS geometry type. Here’s a full example based on the code you provided:Hope that helps.