Skip to content

SYSTEM Cited by 1 source

PostGIS

What it is

PostGIS is the geospatial extension to PostgreSQL, providing spatial data types (geometry, geography, raster), spatial indexes (GiST, SP-GiST), and hundreds of spatial functions (projection, topology, tile production, grid generation). It is the de facto open-source standard for managing geospatial data (Source: sources/2021-12-01-zalando-maps-with-postgresql-and-postgis). Homepage: postgis.net.

PostGIS is a canonical third-party instance of the Postgres extension over fork pattern: originally released 2001, continuously developed, and runs on mainline Postgres via the public extension API — no fork.

Tile-production API surface (relevant to vector-tile serving)

The functions systems/pg-tileserv and similar thin HTTP shims lean on to turn PostGIS tables and SQL functions into Mapbox Vector Tiles:

  • ST_TileEnvelope(z, x, y) — return the Web-Mercator envelope geometry for a given tile coordinate.
  • ST_AsMVTGeom(geom, envelope) — clip/transform a geometry into the MVT tile coordinate space.
  • ST_AsMVT(row_set, layer_name) — encode a row set (with MVT-geom column + attribute columns) as a binary MVT Protocol Buffer blob.
  • ST_HexagonGrid(size, bounds) — generate a hexagon grid of a given size covering a bounds geometry. Returned as a set of (geom, i, j) rows.
  • ST_Transform(geom, srid) — reproject a geometry between spatial reference systems (e.g. Web-Mercator 3857 ↔ WGS84 4326).
  • ST_Centroid(geom) — reduce a polygon to its centroid point (commonly used to turn polygon data into point-in-hex joinable form to avoid double-counting).

Seen in

  • sources/2021-12-01-zalando-maps-with-postgresql-and-postgis — Zalando Postgres Operator team (Nikolai Averkiev, 2021-12-01) canonicalises the claim "these days PostGIS can take over most of the middleware's job and produce map tiles for you". Worked example: a population_hexagons(z,x,y,step) PL/SQL function over ST_TileEnvelope + ST_HexagonGrid
  • LATERAL join to a Eurostat 1 km² population grid + ST_AsMVT returns a PBF blob directly from the database. Deployment context: PostGIS pre-compiled into the Spilo Docker image the Postgres Operator runs; installed declaratively into a named schema via preparedDatabases.<db>.extensions.postgis: <schema> on the Postgresql custom resource. First wiki canonical page.
Last updated · 501 distilled / 1,218 read