Skip to content

docs(decisions): OSM ingest reads .osm XML in-house, and .pbf turns on zlib (p7-s4) (#244) - #499

Merged
JArmandoAnaya merged 1 commit into
mainfrom
docs/244-adr-0012-osm-ingest
Jul 29, 2026
Merged

JArmandoAnaya merged 1 commit into
mainfrom
docs/244-adr-0012-osm-ingest

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

First of six PRs for #244 (p7-s4, OSM road-network extraction + scale targets), the last sprint of pillar P7. Docs only — no code changes, and cmake/deps.cmake does not change at all, which is the point.

The decision, and why it is not the one it looks like

p7-s4 is the third import sprint in a row to open by asking what it is allowed to depend on. It inherits ADR-0010 (no GDAL/PROJ) and ADR-0011 (no PDAL) intact and needs nothing from either: OSM data is WGS 84 lon/lat — EPSG:4326, the hub of the bounded CRS family ADR-0010 already computes in closed form. There is no new coordinate question here. The only open question was the container.

.osm is XML, and pugixml is already linked (core/src/xodr/reader.cpp), so reading it costs zero new dependencies and zero build time.

.osm.pbf is refused — on zlib, not on Protocol Buffers. The obvious argument (protobuf is heavyweight) is true of the library and irrelevant, because we would not take the library: the OSM PBF schema uses a handful of field types and a decoder is varints and length-delimited fields, a few hundred lines of exactly the character ADR-0011 chose to write for ASPRS LAS. On that axis .pbf passes ADR-0011's test.

It fails because every .osm.pbf in circulation stores its blobs as zlib_data, and zlib is deliberately not a dependency — cmake/deps.cmake:195 sets zlib OFF for libtiff, which is precisely why Deflate and JPEG-in-TIFF sit in ADR-0010's refused column rather than failing silently. Adding zlib is already scoped work: #484 owns the pinned tag, the URL_HASH, the licences row and the build-cost measurement.

So this is the same ruling a third time: the part we actually want drags in work that belongs to another sprint, and taking it here would be taking it badly. ADR-0010's sentence — "the proj.db delivery work is that sprint's scope, not a rider on it" — applies to zlib and #484 without modification.

The practical cost is smaller than the 10× file-size difference suggests: the Overpass API returns .osm XML directly, and osmium cat -o district.osm converts a Geofabrik extract in one command. The refusal diagnostic says both, names zlib, and cites #494.

docs/domain/osm_mapping.md — a governing spec doc

The highway=* and tag tables are marked rm-osm and will be mirrored by a code table in core/include/roadmaker/osm/tags.hpp, with test_osm_mapping.cpp failing CI on divergence — the realism_defaults.md mechanism. Landing the doc first means the mapping is reviewable as a policy before any code implements it.

Two things in it are worth reading rather than skimming:

  • The contract cuts both ways. Nothing is dropped silently — and a way imported without compromise produces no diagnostic at all. Warning about everything is indistinguishable from warning about nothing, and only the second half of that rule catches it.
  • No metre is authored in the document. The mapping selects a road class or adds and removes whole lanes; every width comes from roadmaker::defaults. A width literal in the OSM importer would fail test_defaults_registry.cpp's no-private-width-table gate, and correctly so.

It also records the reasoning for the judgement calls rather than leaving them to be re-litigated: why highway=road becomes a collector and says so, why service is off by default, why oneway=-1 reverses the polyline instead of the lane direction (@s would otherwise increase against travel and every station-anchored stop line, signal and bridge span would read backwards), why the simplify tolerance is 0.5 m (below OSM's own 1–3 m tracing noise floor, and under one lane width), and why layer partitions the topology graph before degree is counted — without that rule the import silently welds an overpass to the road beneath it, which is invisible in plan view and wrong in every 3D consumer.

Follow-ups filed

Each is cited by the refusal or compromise diagnostic that would otherwise be a dead end:

Verification

Every relative link in the four touched files resolves (checked against --include-fragments, which the docs job uses). No source files touched, so the change-detection path filter correctly skips the build matrix.

…n zlib

ADR-0012 records p7-s4's format scope. The refusal of .osm.pbf is not the
one it looks like: the Protocol Buffers half is a few hundred lines of
varint decoding, of exactly the character ADR-0011 chose to write for LAS.
It fails on zlib, which every real .osm.pbf uses for its blobs and which
this project deliberately does not depend on (deps.cmake sets zlib OFF for
libtiff, which is why Deflate sits in ADR-0010's refused column). zlib's
arrival is already scoped as #484, and taking it as a rider on a feature
sprint is what ADR-0010 said not to do.

Reading .osm XML costs nothing: pugixml is already linked, and OSM's only
coordinate system is EPSG:4326 — the hub of the bounded family ADR-0010
computes in closed form. So cmake/deps.cmake does not change at all, for
the first time in the three import sprints.

Adds docs/domain/osm_mapping.md as a governing spec doc: the highway=* and
tag tables it carries are mirrored by a code table and held to it by a CI
divergence test, the realism_defaults.md mechanism. It states the contract
both ways — nothing is dropped silently, AND a way imported without
compromise produces no diagnostic at all, because warning about everything
is indistinguishable from warning about nothing.

Follow-ups filed and cited by the refusal diagnostics: #494 (.pbf, blocked
on #484), #495 (roundabouts as one junction), #496 (vertical separation for
bridge/tunnel/layer), #497 (persisted ODbL attribution), #498 (unify
decimate_ring onto the new public simplifier — held out because it moves
geometry in every surface fill, the #442 hazard).

Refs #244
@JArmandoAnaya
JArmandoAnaya merged commit 0bb0c48 into main Jul 29, 2026
12 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the docs/244-adr-0012-osm-ingest branch July 29, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant