Evidence platform and governance
ADR-0033 — Python, PostGIS, MapLibre and tiles: measured, and deferred
- Repository path
- docs/decisions/ADR-0033-geospatial-toolchain-and-public-geometry.md
- Size · SHA-256
- 4.3 KB · ad5b3e4e401048bd08c7f536706f2fff6fba98538ac8774c4079195fba24b7f6
Status
Accepted (Phase 11).
Context
Phase 11 was the first phase with a real geological dataset in hand and an explicit instruction to reassess three deferrals seriously rather than by habit. Each is a genuine capability with a genuine cost, and each has a threshold that can be measured rather than argued about.
Measurements taken on the Phase 10 baseline, before any Phase 11 ingestion:
| Quantity | Value |
|---|---|
| Spatial representation records | 161 |
| Total stored positions | 8,960 |
| Largest single geometry | 569 positions |
| Canonical spatial store on disk | 631 KB |
| Atlas page, server-rendered | 239 KB HTML |
| Client JavaScript, whole site | 648 KB |
| Client map library | none |
| Source CRSs in use | EPSG:4326 only |
| Source formats in use | GeoJSON only |
Decisions
1. Python GIS toolchain — DEFERRED again.
The candidate stack (uv, pyogrio, shapely, pyproj) earns its keep when a dataset arrives
in a projected CRS needing real reprojection, in a binary format needing GDAL to decode, or
with topology needing GEOS to repair. The dataset Phase 11 accepted arrives as GeoJSON in
decimal degrees, needs coordinate rounding and a Douglas–Peucker simplification, and both
already exist in @lithoen/geospatial and run inside the existing deterministic ingestion
CLI. Adding Python would buy a second toolchain, a second test runner and a second
dependency-pinning problem for no capability the phase needed.
The trigger is stated so the next phase does not have to re-argue it. Introduce Python when any one of these is true: a dataset is published in a projected CRS whose transformation to WGS84 is material at its own capture scale; a dataset is published only as Shapefile, GeoPackage, GDB or GeoTIFF; a geometry fails validation in a way that needs GEOS to repair rather than to refuse; or raster ingestion begins.
Note what the GDA94 case did not do: it did not trigger this. The transformation was material at neither the datum's magnitude nor the data's scale, and the correct engineering answer was a recorded decision rather than a computation. A toolchain adopted to perform a transformation you have decided not to perform is a toolchain adopted for its own sake.
2. PostGIS — DEFERRED.
161 records and 8,960 positions. The whole canonical store is 631 KB, which is smaller than
one photograph in data/public/visuals. Nothing in the build is memory-bound on geometry.
There are no spatial joins in the product, because the one spatial derivation Phase 11
performs is a five-point containment test that runs in milliseconds against a committed
file. Introduce PostGIS when the canonical store exceeds roughly a million positions,
or when spatial queries are needed at request time rather than at build time, or when
incremental update of a large fabric becomes the bottleneck. None is close.
3. MapLibre — DEFERRED.
The atlas is a 239 KB server-rendered SVG and the entire site ships 648 KB of JavaScript. MapLibre GL alone is of that order before any data, style or tiles. A map library buys pan, zoom and layer toggles; at 8,960 positions across 161 records, the SVG already shows everything there is, and the interaction would be navigating a corpus the reader can also navigate by name. Introduce MapLibre when layer toggling becomes the primary way to read the data — which means several geological fabrics that overlap and must be compared — or when the geometry exceeds what an SVG can render legibly.
4. Vector tiles / PMTiles — DEFERRED, and measurement-gated.
Not evaluated in depth, deliberately: §51 says measure first, and the public payload is three orders of magnitude below where tiling begins to pay. Revisit when public geometry approaches a few megabytes.
Consequences
Phase 11 added one dataset, one mapped extent and 243 published positions. The atlas grew by one route. None of the three deferred technologies would have made any of that better, and each would have made the repository harder to verify from clean.
The risk this ADR accepts is that a future phase ingesting a national geological map at 1:250,000 will cross several thresholds at once and have to do this work under pressure. That is a real cost and it is smaller than carrying an unused GIS stack through four phases.