PostGIS

PostGIS is the geospatial extension for PostgreSQL. It adds geometry and geography data types, hundreds of spatial functions, spatial indexes (GiST, SP-GiST, BRIN), and conformance to the OGC Simple Features standard. PostGIS is the de facto open-source geospatial database, used by mapping platforms, logistics systems, and any application that asks "what is near here".

What it provides

  • Geometry types. Points, lines, polygons, multi-geometries, geometry collections, with optional Z and M dimensions.
  • Geography type. Like geometry but computed on a sphere (or spheroid) so distances are in metres, not degrees.
  • Spatial predicates. ST_Intersects, ST_Contains, ST_Within, ST_DWithin, ST_Distance, and many more.
  • Transforms. Reproject between coordinate systems via ST_Transform and the projection database (EPSG codes).
  • Spatial indexes. GiST indexes accelerate proximity queries from full scans to milliseconds.
  • Raster support. Store and query raster data alongside vector geometries.

Common queries

  • "Find all coffee shops within 500 metres of this point" - ST_DWithin + spatial index.
  • "Which census tract contains this address?" - point-in-polygon via ST_Contains.
  • "Compute drive-time isochrones" - combine PostGIS geometry with routing extensions (pgRouting).
🔗
Related Terms
PostgreSQL, SQL, pgvector.

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon