Geospatial
Geospatial values say where things are, and what is near or inside what: a bakery's position, the patches it delivers to, the shops within five kilometres of a customer, the pins inside the map a…
Geospatial values say where things are, and what is near or inside what: a bakery's position, the patches it delivers to, the shops within five kilometres of a customer, the pins inside the map a person is looking at.
The types are standard types, listed under
Geospatial types: Point,
with a named latitude and longitude, five other geometries such as
Polygon, and Geometry, which holds any one of the six. All of them
are in WGS84, the coordinate system GPS uses, and are sent as GeoJSON.
This page covers what you do with them:
| Part | What | Builds on |
|---|---|---|
| Operations | 10 in geo: distance, length, bearing, area, intersects, contains, within (with or without distance:), centroid, bounding box; and the two for WKT text |
The standard library's operations and its whole-number maths |
| Storage | One PostGIS geography column per geometry, checked to its type and WGS84; GiST indexes derived from your queries |
Storage types |
| Queries | geo.within, geo.contains, geo.intersects as where: conditions; order: by geo.distance inside a radius |
Reads and writes |
| Interop | GeoJSON Feature and FeatureCollection; WKT where other systems use it |
The standard library's GeoJSON |
PostGIS is the PostgreSQL extension for geographic data. Where this page
says a PostGIS behaviour was verified, it was checked against PostGIS
3.4.2 on PostgreSQL 16. Some compiler messages cite a decision by number,
as in question 10; the Decisions table in the
design notes lists them.
Markdown for agents: /docs/geospatial.md.Built from Jadpo main at a707efb.