Skip to content

p7-s4: OSM road-network extraction + scale targets #244

Closed

Description

@JArmandoAnaya

Part of the Road to Parity roadmap.

Scope

  • OSM extraction with diagnostics-first fitting: every dropped/approximated element yields a structured warning.
  • Scale/perf harness: 1k-road network and 50 km² import targets measured in CI.

Acceptance

  • An OSM district imports into an editable network meeting the perf targets; diagnostics enumerate the fitting compromises.

Out of scope

Terrain (p5-s4) and imagery (p7-s2) are separate.

Supersedes

#54 (scale targets and measurement harness)

Activity

  1. added
    pillar:P7
    on Jul 15, 2026
  2. JArmandoAnaya commented on Jul 27, 2026

    @JArmandoAnaya
    ContributorAuthor

    2026-07-27 roadmap review — corrections and cross-references (issue written before recent landings; body stands, read with these):

  3. JArmandoAnaya commented on Jul 29, 2026

    @JArmandoAnaya
    ContributorAuthor

    Closed by five PRs

    PR main What
    #499 0bb0c48 ADR-0012 + docs/domain/osm_mapping.md
    #500 2feb75a road <type>/<speed> (#454's modelling half)
    #501 ffe8d79 .osm reader, tag mapping, polyline simplifier
    #503 e480b4e network plan, single-undo import, scale harness
    #504 — editor action, Python bindings, GW-2 steps 38–45

    Acceptance

    An OSM district imports into an editable network meeting the perf targets; diagnostics enumerate the fitting compromises.

    Met, with one number reported honestly rather than flattered — see the perf section.

    • An .osm extract becomes a real, editable network: ways classified onto the four road classes, split at OSM's own shared nodes, joined as links or generated junctions, in one undoable command.
    • Diagnostics-first fitting is a contract in the type system, not a promise. FitCompromise carries the measured node counts and the actual deviation in metres, and the diagnostic is a rendering of it — so a build that stopped warning would also have to stop being able to answer max_deviation_m, which a test asks directly.
    • The contract cuts both ways: a way imported without compromise produces no diagnostic at all. Warning about everything says exactly as much as warning about nothing.

    The decision (ADR-0012): .osm XML in-house, .pbf refused — on zlib, not protobuf

    The obvious argument — Protocol Buffers is a heavyweight dependency — is true of the library and irrelevant, because we would not take the library: the OSM PBF schema 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 absent (deps.cmake:195 turns it off for libtiff — the reason Deflate sits in ADR-0010's refused column). zlib's arrival is already scoped as #484. Third instance of the same ruling, and cmake/deps.cmake did not change at all — the first import sprint of three for which that is true.

    What the tests and the bench found, none of which this issue named

    1. The import produced no junctions at all. OSM states a crossing by sharing a node, so every arm runs to exactly the same point — and a connecting road between two arms meeting at a point has zero length and nowhere to curve. A 7×7 lattice planned 25 junctions and built zero, every turn reporting "clothoid fit failed" — and it still looked plausible in the road count, because the authored roads were all there. Fixed by pulling junction arms back 12 m (never link arms, whose ends must stay coincident); the same lattice now builds 45 junctions and drops no turns. No unit test found this — the scale bench did, because it was the first thing to inspect the built network rather than the plan.

    2. for_each_road does not yield creation order. It walks slots ascending and reuses freed ones, so the first id-recovery design — an arena diff paired with the plan positionally — produced two roads carrying each other's geometry, exactly the "welds the wrong ends together, silently" failure it existed to prevent. Fixed by deleting the assumption: edit::create_road gained an optional odr_id, and the joint stage builds one O(n) map. Order-independent by construction.

    3. Four of my own tests were vacuous, each caught by sabotage or by running the example. The most instructive asserted only that every planned odr_id was findable — which a permutation preserves perfectly. A pairing must be checked as a pairing. And one sabotage was itself incoherent: it patched one of three key-construction sites, leaving the code neither correct nor consistently broken, so its "pass" meant nothing.

    4. lossless is about the shape, not the vertex count. Running python/examples/osm_import.py showed every road reported as compromised at 0.000 m deviation. A way traced along a constant latitude is a curve once projected, so three collinear nodes deviate ~1 mm from their own chord and a micron-scale epsilon calls clean data compromised.

    Scale targets (supersedes #54)

    A new scale targets CI job runs roadmaker_scale_bench — a separate executable ctest never runs, because ctest -j 4 starts ~1 800 processes on a four-core runner and a timing test inside that set measures the scheduler. It uploads scale-metrics.json, the repository's first metrics artifact, and the job asserts every key is present before uploading: a bench that quietly did not run is otherwise indistinguishable from a green one.

    metric measured (dev, 420 segments → 3 064 roads)
    parse + plan 0.7 ms
    network build 19 102 ms
    .xodr load (4.6 MB) 140 ms
    one-road remesh 0.081 ms
    peak RSS 110 MB
    parse+plan growth ratio 3.84 (quadratic ≈ 16)

    Node-drag latency is flat — 0.068 ms on 1 624 roads, 0.081 ms on 3 064 — which is the answer that metric exists to give.

    The build number is bad, and it is reported rather than hidden. The step is super-linear: 84 segments cost 92 ms and 420 cost 19 200 — five times the roads for two hundred times the time. Filed as #502, with the suspect named and "confirm before fixing" stated. The CI job therefore runs a smaller district and the ceiling sits deliberately far above where it belongs, both facts stated in the code. Shrinking the district permanently and reporting a flattering number was the alternative, and it would have dodged the only question #54 asked.

    test_osm_scale.cpp runs the same code at reduced size in the ordinary suite, so the scale path is compiled and exercised on all three platforms every PR while only the numbers are Linux-gated.

    Follow-ups filed, labelled, milestoned and on the board

    #454 stays open for its second half (stamping <type> from the road class at create_road), with a comment explaining exactly what landed and why the rest was held back.

    Out of scope, as stated

    Building-footprint extrusion, terrain (p5-s4) and imagery (p7-s2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pillar:P7

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions