PostGIS is a spatial extension for the PostgreSQL relational database. It adds geometry and geography column types, spatial indexing, and a large library of SQL functions for measuring, transforming, and relating spatial features. With PostGIS, a standard SQL database becomes a full-featured spatial engine that handles vector data (and, via raster support, grids) at scale.

Why it matters

For teams beyond single-file workflows, PostGIS provides a central, multi-user spatial store with transactional integrity, fine-grained queries, and performance that file formats cannot match. It powers web-mapping backends (serving vector tiles and GeoJSON), enforces data quality through SQL constraints, and lets analysts run spatial joins and overlays directly in the database rather than loading everything into desktop GIS.

Concrete example

Reproject and measure in one query:

SELECT name, ST_Area(ST_Transform(geom, 32631)) AS area_m2 FROM units;

Here ST_Transform reprojects geometries to UTM Zone 31N (EPSG:32631) so ST_Area returns square metres. A spatial (GiST) index created with CREATE INDEX ON units USING GIST (geom); makes bounding-box filters and joins fast.

Common pitfall

Confusing the geometry and geography types. geometry does planar (flat) math in whatever CRS the SRID specifies, so areas and distances are only correct in a suitable projected CRS. geography computes true distances on the ellipsoid in metres but supports fewer functions and is slower. Also, ST_SetSRID only labels a geometry's CRS; it does not move coordinates, whereas ST_Transform actually reprojects them.

Related reading