Documentation
¶
Overview ¶
Package postgis is a built-in plugin exposing PostGIS spatial columns as a full GraphQL query surface.
Default generation already reads and writes spatial columns as GeoJSON (the core compiler handles the GeoJSON scalar). This plugin adds everything built on top of that:
spatial filters: every geometry/geography column gets a GeometryFilterOps operand set covering bounding-box operators (bboxIntersects/&&, bboxContains/~, bboxContainedBy/@), the DE-9IM predicates (intersects, contains, within, covers, crosses, touches, overlaps, equals, disjoint, containsProperly, coveredBy), and radius search (dwithin/beyond). Bounding-box and dwithin operators are GiST-index-usable, which is what keeps viewport and "near me" queries fast on large tables.
derived accessors: each spatial column gains sibling fields for the scalar properties PostGIS can compute in the same statement — <field>Area, <field>Length, <field>Perimeter, <field>Centroid, <field>Envelope, <field>Srid, <field>GeometryType, <field>IsValid.
projection arguments: spatial fields accept transform: (reproject to an SRID) and simplify: (ST_SimplifyPreserveTopology tolerance), so clients can pull web-mercator or low-vertex geometry without a second query.
distance ordering: <COLUMN>_DISTANCE_ASC/_DESC orderBy values plus a `near:` argument on list and connection fields, compiled to the index-assisted KNN operator (<->).
Geometry and geography are both supported. They share the operator vocabulary but differ in units: geography measures in metres, geometry in SRID units. dwithin takes a `useSpheroid` flag so lat/lon data stored as plain geometry can still be searched in metres.
Like advanced-filters, the plugin only adds schema surface plus catalog bindings; the compiler reads the bindings and stays inert when they are absent, so disabling the plugin (plugins.disabled: postgis) removes the surface completely while plain GeoJSON read/write keeps working.
Per-object control follows the same smart-comment conventions as the rest of the codebase: "@omit filter" / "@omit order" on a spatial column skips its filter / ordering surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the SchemaHook adding the spatial surface.