OpenMapStack Toolkit
Production-grade geospatial workflows with an open-first stack and pragmatic hosted/SaaS choices when global scale, latency, SLA, or data quality makes local processing a poor fit. Cloud-native by default: STAC for discovery, GeoParquet + COG + PMTiles for storage, DuckDB and PostGIS for compute, MapLibre and Martin for delivery.
Reproducible project-first contract
For every material multi-stage GIS analysis, compile or maintain a deterministic,
inspectable, reproducible technical project before delivery. A map, dashboard or
report is a view over that project, not the canonical definition of the analysis.
Before compiling or delivering a material analysis, read
references/project-workflow.md for the mandatory workflow and delivery rules,
and references/project-spec.md for the full openmapstack-project/v1 schema.
Use templates/ and the worked examples/tartu-development project.
Keep authoritative sources real, immutable and pinned; never invent baseline
geometry without explicit informed consent. Record assumptions and every manual
correction as data or canonical pipeline logic, make overrides executable and
verified, and preserve unknown semantic attributes as unknown. The project must
have explicit CRS, deterministic ordered steps, machine-readable validation and
run evidence, provenance, and a documented clean rerun without chat dependencies.
Run openmapstack validate and the canonical openmapstack run path when the CLI
is available. Missing validation capability is not_testable, never an implicit
pass. Follow the referenced workflow's complete QGIS and presentation obligations.
For a bounded one-shot SQL, CRS or conversion question, the relevant domain
reference is sufficient; a full project artifact and its methodology are not needed.
Modules — read the relevant reference(s) before starting work
| If the task involves... |
Read |
| Finding or sourcing data (OSM, Overture, Sentinel, Landsat, building footprints, regional portals, STAC and Portolan catalogs, MCP-based discovery) |
references/data-sources.md |
| Reading the user's own warehouse or database (PostGIS, DuckDB, GeoParquet directories): credentials by reference, read-only discovery, approved snapshots, pin classes |
references/user-data-sources.md |
| Choosing local processing vs online/hosted/SaaS services for global or continental scale; basemaps, elevation, routing, geocoding, place search, postcode lookup APIs |
references/services-and-scale.md |
| Choosing a format, converting between formats, or any CRS / projection / EPSG question |
references/formats-and-crs.md |
Compiling a reproducible GIS project artifact (project.yaml, pipeline, overrides, validation, presentation) |
references/project-spec.md + templates/ |
| Running GDAL/OGR, GeoPandas, xarray, DuckDB, PostGIS, or PDAL — the actual processing |
references/processing.md |
| Writing or reviewing spatial SQL / GeoSQL in DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake, or Sedona |
references/spatial-sql.md |
| Vector analytics, raster analytics, terrain/hydrology, network analysis, point cloud workflows |
references/analytics.md |
| Tile generation (PMTiles, MVT), tile servers (Martin, TiTiler), delivered rendering (MapLibre, deck.gl), or exploration rendering (kepler.gl, lonboard) |
references/web-delivery.md |
| QGIS desktop, QGIS plugin ecosystem, QGIS MCP, PyQGIS scripting, Processing toolbox |
references/qgis.md |
| Reproducibility, validation, license attribution, tile smoke tests, deployment checks |
references/validation-and-ops.md |
For simple one-shot questions (single CRS conversion, one ogr2ogr invocation), the relevant reference alone is sufficient — a full project artifact is not needed. For multi-stage pipelines, read data-sources.md and processing.md together, and see project-spec.md + templates/ to compile analysis into a rerunnable project. For end-to-end "from raw data to web map" tasks, also read web-delivery.md.
Global defaults — apply unless the user specifies otherwise
- Storage formats: GeoParquet (vector analytics), COG (raster), PMTiles (tile delivery), GeoPackage (desktop interchange). Never produce Shapefile as new output.
- CRS: WGS84 (EPSG:4326) for storage; Web Mercator (EPSG:3857) for web rendering; local projected CRS for any metric computation (distance, area, buffer). For Estonia, EPSG:3301 (L-EST97).
- Compute placement: push spatial joins and aggregations to DuckDB or PostGIS — not Python loops. R-tree / GIST / spatial indexing is mandatory at scale.
- Discovery first: check STAC catalogs (Microsoft Planetary Computer, Earth Search, Overture STAC) before downloading anything. Lazy load with
odc-stac or stackstac and only materialize what's needed.
- Cloud-native access: prefer querying remote GeoParquet/COG over downloading. DuckDB with
httpfs extension is the default pattern for Overture and similar S3-hosted datasets.
- Scale first: local tools are fine for city/state work; at continental/global scale prefer cloud-native partitioned datasets, precomputed tiles, hosted APIs, or SaaS when they are more reliable than local batch processing.
- License hygiene: preserve license metadata through every transformation. OSM is ODbL (share-alike); Overture varies by source; Sentinel is free-with-attribution; national data varies.
- Runtime hygiene: prefer
conda-forge environments or containers for GDAL/PROJ/GEOS/QGIS stacks. Avoid pip-only geospatial environments unless the project already proves they work.
Format decision matrix
| Use case |
Format |
| Cloud analytics on vector |
GeoParquet |
| Streaming vector over HTTP |
FlatGeobuf |
| Desktop interchange |
GeoPackage |
| Web map vector tiles |
PMTiles (containing MVT) |
| Raster archive / serving |
COG |
| n-dimensional raster (time series, climate) |
Zarr or NetCDF |
| Point cloud archive |
COPC (cloud-optimized LAZ) |
| API response payload (small only) |
GeoJSON |
| Legacy compatibility (input only) |
Shapefile |
Compute decision matrix
| Scale / context |
Use |
| < 50M features, single machine, ad-hoc |
DuckDB Spatial |
| Multi-user, web app backend, OLTP |
PostGIS |
| > 100M features, distributed |
Apache Sedona |
| Continental/global lookup/search/routing/elevation |
Hosted API or SaaS where coverage, SLA, terms, and price fit |
| Planet-scale basemap delivery |
Prebuilt PMTiles/vector tiles or managed basemap service |
| n-dim raster, lazy/dask-backed |
xarray + rioxarray (+ odc-stac for STAC ingest) |
| CLI batch jobs on raster |
GDAL utilities (gdalwarp, gdal_translate -of COG) |
| Point clouds |
PDAL pipelines |
Terrain & hydrology beyond gdaldem |
WhiteboxTools or GRASS |
| Desktop styling, cartography, ad-hoc exploration |
QGIS (see qgis.md) |
Universal anti-patterns — flag and correct
- Hallucinating or fabricating mock coordinates and geometries instead of retrieving real source data (unless the user gave explicit, informed consent for a synthetic mock test)
- Generating a QGIS project that lacks the web dashboard's layers, omits basemaps, or uses broken OGR datasource syntax (
path.gpkg|layer without layername=), causing layers to load as non-spatial attribute tables
- Writing
.qgs XML by hand with no <srs>, an auth-id-only CRS block, or no ProjectionsEnabled, or copying the manifest's layer order straight into the layer tree — these produce a project where every layer is valid and every datasource resolves, yet the map shows the wrong place or silently hides a layer
- Producing Shapefile as new output (column truncation, 2GB limit, no UTF-8, multi-file)
- Calling
.distance(), .buffer(), or .area on geographic CRS (EPSG:4326) — degrees are not meters; unless specific tool explicitly supports wgs84 based geodesic calculations
- Web Mercator (EPSG:3857) for area or distance calculations — it is not equal-area, and the units are not in meters except at the equator
- Spatial joins in Python loops when DuckDB / PostGIS / R-tree-backed
sjoin is one line away
- Using bbox containment for area queries when features can cross the boundary — use bbox overlap as the scan gate, then an exact spatial predicate
- Downloading entire datasets when STAC + cloud-native formats allow lazy/range-request access
- Running planet-scale local processing for lookup/search problems when reliable hosted services or precomputed global products already exist
- Treating MBTiles as the default for new web deployments — PMTiles is the modern default
- Using GeoTIFF when COG is one flag away (
-of COG)
- Mixing CRS silently — every join must assert matching CRS
- Hand-rolling routing or geocoding when OSRM, Valhalla, or Nominatim are one Docker pull away
- Pinning data to "latest" in a reproducible pipeline — pin Overture release version and STAC item IDs, not just collections. For Overture, verify the pinned release is still available or mirror it.
Quick triage — recognize the request type
Before diving into a task, classify it:
- Discovery ("what data exists for…?", "is there a dataset of…?", "read this catalog") → start with
data-sources.md. STAC search if raster; Overture or OSM if vector basemap; for a Portolan catalog read its AGENTS.md before querying.
- Conversion / CRS ("convert this to…", "reproject to…", "the projection looks wrong") →
formats-and-crs.md. Usually one ogr2ogr or gdalwarp call.
- Analysis ("what's the average elevation in…", "how many buildings within 500m of…", "where are the hotspots?") →
analytics.md and likely processing.md. Push to DuckDB/PostGIS first.
- Delivery ("publish this as a web map", "generate tiles for…") →
web-delivery.md. PMTiles + Martin + MapLibre is the default.
- Desktop / cartography ("style this in QGIS", "make a print map", "automate this in QGIS") →
qgis.md. Consider QGIS MCP for agentic workflows.
Most real tasks span 2–3 of these — read the relevant references in order.
Reproducibility checklist for any pipeline you produce
- Pin dataset versions (Overture release, STAC item IDs, OSM extract dates) — never "latest"
- Document CRS at every stage; never assume
- Use
conda-forge envs or pinned container images (ghcr.io/osgeo/gdal:alpine-small-latest for GDAL, qgis/qgis:<tag> for PyQGIS); pip-only geospatial envs break frequently
- Validate outputs:
gpq for GeoParquet, rio-cogeo validate for COG, pmtiles show for PMTiles, is_valid for geometries
- Preserve license metadata in column or sidecar JSON and carry required attribution into maps/APIs
Command-level detail for each of these lives in references/validation-and-ops.md.
1---2name: open-map-stack3description: Use textual agent instructions for GIS and geospatial work: source discovery and provenance, vector/raster/point-cloud pipelines, CRS and metric analysis, spatial SQL, routing and isochrones, QGIS projects, tile generation, and web maps. Use advanced tools and formats such as OSM, Overture, STAC, Sentinel/Landsat, LiDAR, GeoPackage, GeoParquet, COG, PMTiles, WMS/WFS/OGC APIs, Portolan catalogs, GDAL, GeoPandas, DuckDB Spatial, PostGIS, QGIS, MapLibre, and Estonian spatial data including ETAK and EPSG:3301. Open-first, with hosted services when scale or reliability requires them. Do not use for casual map references, simple place lookups, or ordinary travel directions without analytical GIS work.4---56# OpenMapStack Toolkit78Production-grade geospatial workflows with an open-first stack and pragmatic hosted/SaaS choices when global scale, latency, SLA, or data quality makes local processing a poor fit. Cloud-native by default: STAC for discovery, GeoParquet + COG + PMTiles for storage, DuckDB and PostGIS for compute, MapLibre and Martin for delivery.910## Reproducible project-first contract1112For every material multi-stage GIS analysis, compile or maintain a deterministic,13inspectable, reproducible technical project before delivery. A map, dashboard or14report is a view over that project, not the canonical definition of the analysis.1516**Before compiling or delivering a material analysis, read17`references/project-workflow.md` for the mandatory workflow and delivery rules,18and `references/project-spec.md` for the full `openmapstack-project/v1` schema.**19Use `templates/` and the worked `examples/tartu-development` project.2021Keep authoritative sources real, immutable and pinned; never invent baseline22geometry without explicit informed consent. Record assumptions and every manual23correction as data or canonical pipeline logic, make overrides executable and24verified, and preserve unknown semantic attributes as unknown. The project must25have explicit CRS, deterministic ordered steps, machine-readable validation and26run evidence, provenance, and a documented clean rerun without chat dependencies.27Run `openmapstack validate` and the canonical `openmapstack run` path when the CLI28is available. Missing validation capability is `not_testable`, never an implicit29pass. Follow the referenced workflow's complete QGIS and presentation obligations.3031For a bounded one-shot SQL, CRS or conversion question, the relevant domain32reference is sufficient; a full project artifact and its methodology are not needed.3334## Modules — read the relevant reference(s) before starting work3536| If the task involves... | Read |37|---|---|38| Finding or sourcing data (OSM, Overture, Sentinel, Landsat, building footprints, regional portals, STAC and Portolan catalogs, MCP-based discovery) | `references/data-sources.md` |39| Reading the user's own warehouse or database (PostGIS, DuckDB, GeoParquet directories): credentials by reference, read-only discovery, approved snapshots, pin classes | `references/user-data-sources.md` |40| Choosing local processing vs online/hosted/SaaS services for global or continental scale; basemaps, elevation, routing, geocoding, place search, postcode lookup APIs | `references/services-and-scale.md` |41| Choosing a format, converting between formats, or any CRS / projection / EPSG question | `references/formats-and-crs.md` |42| Compiling a reproducible GIS project artifact (`project.yaml`, pipeline, overrides, validation, presentation) | `references/project-spec.md` + `templates/` |43| Running GDAL/OGR, GeoPandas, xarray, DuckDB, PostGIS, or PDAL — the actual processing | `references/processing.md` |44| Writing or reviewing spatial SQL / GeoSQL in DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake, or Sedona | `references/spatial-sql.md` |45| Vector analytics, raster analytics, terrain/hydrology, network analysis, point cloud workflows | `references/analytics.md` |46| Tile generation (PMTiles, MVT), tile servers (Martin, TiTiler), delivered rendering (MapLibre, deck.gl), or exploration rendering (kepler.gl, lonboard) | `references/web-delivery.md` |47| QGIS desktop, QGIS plugin ecosystem, QGIS MCP, PyQGIS scripting, Processing toolbox | `references/qgis.md` |48| Reproducibility, validation, license attribution, tile smoke tests, deployment checks | `references/validation-and-ops.md` |4950For simple one-shot questions (single CRS conversion, one `ogr2ogr` invocation), the relevant reference alone is sufficient — a full project artifact is not needed. For multi-stage pipelines, read `data-sources.md` and `processing.md` together, and see `project-spec.md` + `templates/` to compile analysis into a rerunnable project. For end-to-end "from raw data to web map" tasks, also read `web-delivery.md`.5152## Global defaults — apply unless the user specifies otherwise5354* **Storage formats:** GeoParquet (vector analytics), COG (raster), PMTiles (tile delivery), GeoPackage (desktop interchange). Never produce Shapefile as new output.55* **CRS:** WGS84 (EPSG:4326) for storage; Web Mercator (EPSG:3857) for web rendering; local projected CRS for any metric computation (distance, area, buffer). For Estonia, EPSG:3301 (L-EST97).56* **Compute placement:** push spatial joins and aggregations to DuckDB or PostGIS — not Python loops. R-tree / GIST / spatial indexing is mandatory at scale.57* **Discovery first:** check STAC catalogs (Microsoft Planetary Computer, Earth Search, Overture STAC) before downloading anything. Lazy load with `odc-stac` or `stackstac` and only materialize what's needed.58* **Cloud-native access:** prefer querying remote GeoParquet/COG over downloading. DuckDB with `httpfs` extension is the default pattern for Overture and similar S3-hosted datasets.59* **Scale first:** local tools are fine for city/state work; at continental/global scale prefer cloud-native partitioned datasets, precomputed tiles, hosted APIs, or SaaS when they are more reliable than local batch processing.60* **License hygiene:** preserve license metadata through every transformation. OSM is ODbL (share-alike); Overture varies by source; Sentinel is free-with-attribution; national data varies.61* **Runtime hygiene:** prefer `conda-forge` environments or containers for GDAL/PROJ/GEOS/QGIS stacks. Avoid pip-only geospatial environments unless the project already proves they work.6263## Format decision matrix6465| Use case | Format |66|---|---|67| Cloud analytics on vector | GeoParquet |68| Streaming vector over HTTP | FlatGeobuf |69| Desktop interchange | GeoPackage |70| Web map vector tiles | PMTiles (containing MVT) |71| Raster archive / serving | COG |72| n-dimensional raster (time series, climate) | Zarr or NetCDF |73| Point cloud archive | COPC (cloud-optimized LAZ) |74| API response payload (small only) | GeoJSON |75| Legacy compatibility (input only) | Shapefile |7677## Compute decision matrix7879| Scale / context | Use |80|---|---|81| < 50M features, single machine, ad-hoc | DuckDB Spatial |82| Multi-user, web app backend, OLTP | PostGIS |83| > 100M features, distributed | Apache Sedona |84| Continental/global lookup/search/routing/elevation | Hosted API or SaaS where coverage, SLA, terms, and price fit |85| Planet-scale basemap delivery | Prebuilt PMTiles/vector tiles or managed basemap service |86| n-dim raster, lazy/dask-backed | xarray + rioxarray (+ odc-stac for STAC ingest) |87| CLI batch jobs on raster | GDAL utilities (`gdalwarp`, `gdal_translate -of COG`) |88| Point clouds | PDAL pipelines |89| Terrain & hydrology beyond `gdaldem` | WhiteboxTools or GRASS |90| Desktop styling, cartography, ad-hoc exploration | QGIS (see `qgis.md`) |9192## Universal anti-patterns — flag and correct9394* Hallucinating or fabricating mock coordinates and geometries instead of retrieving real source data (unless the user gave explicit, informed consent for a synthetic mock test)95* Generating a QGIS project that lacks the web dashboard's layers, omits basemaps, or uses broken OGR datasource syntax (`path.gpkg|layer` without `layername=`), causing layers to load as non-spatial attribute tables96* Writing `.qgs` XML by hand with no `<srs>`, an auth-id-only CRS block, or no `ProjectionsEnabled`, or copying the manifest's layer order straight into the layer tree — these produce a project where every layer is valid and every datasource resolves, yet the map shows the wrong place or silently hides a layer97* Producing Shapefile as new output (column truncation, 2GB limit, no UTF-8, multi-file)98* Calling `.distance()`, `.buffer()`, or `.area` on geographic CRS (EPSG:4326) — degrees are not meters; unless specific tool explicitly supports wgs84 based geodesic calculations99* Web Mercator (EPSG:3857) for area or distance calculations — it is not equal-area, and the units are not in meters except at the equator100* Spatial joins in Python loops when DuckDB / PostGIS / R-tree-backed `sjoin` is one line away101* Using bbox containment for area queries when features can cross the boundary — use bbox overlap as the scan gate, then an exact spatial predicate102* Downloading entire datasets when STAC + cloud-native formats allow lazy/range-request access103* Running planet-scale local processing for lookup/search problems when reliable hosted services or precomputed global products already exist104* Treating MBTiles as the default for new web deployments — PMTiles is the modern default105* Using GeoTIFF when COG is one flag away (`-of COG`)106* Mixing CRS silently — every join must assert matching CRS107* Hand-rolling routing or geocoding when OSRM, Valhalla, or Nominatim are one Docker pull away108* Pinning data to "latest" in a reproducible pipeline — pin Overture release version and STAC item IDs, not just collections. For Overture, verify the pinned release is still available or mirror it.109110## Quick triage — recognize the request type111112Before diving into a task, classify it:1131141. **Discovery** ("what data exists for…?", "is there a dataset of…?", "read this catalog") → start with `data-sources.md`. STAC search if raster; Overture or OSM if vector basemap; for a Portolan catalog read its `AGENTS.md` before querying.1152. **Conversion / CRS** ("convert this to…", "reproject to…", "the projection looks wrong") → `formats-and-crs.md`. Usually one `ogr2ogr` or `gdalwarp` call.1163. **Analysis** ("what's the average elevation in…", "how many buildings within 500m of…", "where are the hotspots?") → `analytics.md` and likely `processing.md`. Push to DuckDB/PostGIS first.1174. **Delivery** ("publish this as a web map", "generate tiles for…") → `web-delivery.md`. PMTiles + Martin + MapLibre is the default.1185. **Desktop / cartography** ("style this in QGIS", "make a print map", "automate this in QGIS") → `qgis.md`. Consider QGIS MCP for agentic workflows.119120Most real tasks span 2–3 of these — read the relevant references in order.121122## Reproducibility checklist for any pipeline you produce123124* Pin dataset versions (Overture release, STAC item IDs, OSM extract dates) — never "latest"125* Document CRS at every stage; never assume126* Use `conda-forge` envs or pinned container images (`ghcr.io/osgeo/gdal:alpine-small-latest` for GDAL, `qgis/qgis:<tag>` for PyQGIS); pip-only geospatial envs break frequently127* Validate outputs: `gpq` for GeoParquet, `rio-cogeo validate` for COG, `pmtiles show` for PMTiles, `is_valid` for geometries128* Preserve license metadata in column or sidecar JSON and carry required attribution into maps/APIs129130Command-level detail for each of these lives in `references/validation-and-ops.md`.