Repository navigation
feat: your scene can say where on the earth it is (p7-s5) (#324) - #483
Conversation
The <header><geoReference> and <header><offset> elements of OpenDRIVE 8.5, as a document-scoped value on RoadNetwork beside the height field, plus the verbatim passthrough for the rest of <header>. No PROJ. The one construction this module understands is the Transverse Mercator centred on the scene origin that 8.5 itself recommends, in which local and projected coordinates are the same numbers, so nothing needs transforming. Any other CRS is carried verbatim and reported as opaque until p7-s2 brings in the library that can read it.
parse_header becomes the header-child dispatch that #324 and #453 share: <geoReference> and <offset> are modeled, and everything else the header holds — <license>, <dataQuality>, <include>, foreign <userData>, unknown attributes — is preserved verbatim instead of vanishing. A georeferenced foreign file used to lose its projection string with no diagnostic anywhere. The writer emits the north/south/east/west bounding box from the network it is writing, the projection string as the only CDATA node RoadMaker produces, and the offset only when it is not the identity. validate_network gains 8.5's centred-coordinates advisory.
#324) edit::set_georeference captures the whole value before and after, like the height field it sits beside. Its DirtySet is EMPTY on purpose: a georeference says how the scene's coordinates relate to the earth, not where anything is, so nothing needs re-meshing. Python gets GeoReference, GeoOffset, the 8.5 offset affine both ways, and the two Transverse Mercator helpers, plus an example that georeferences a scene, saves it, and reads the origin back out of the file.
XodrPreview gains the header the writer would produce, read out of the emitted bytes like every other number there. That distinction earns its keep immediately: the network can hold an identity offset the file will not carry, and only the bytes know. The window names the world origin when it can compute one, and reports the projection verbatim when it cannot.
…against (p7-s5, #324) Edit > World Georeference authors the projection two ways — a world origin that generates the Transverse Mercator 8.5 recommends, or a CRS pasted verbatim — plus the dataset offset, committed as ONE undoable command. The workspace box is the other half and lives in the other layer: it goes in the scene sidecar with the projection string it was framed in, and a box framed under a georeference the scene no longer carries is discarded with a diagnostic rather than framing the user on coordinates that now mean somewhere else. View > Centre on World Origin moves the pivot without touching the zoom.
…docs (#324) Also georeferences a committed sample and adds three corpus seeds. Until now NOT ONE committed .xodr carried a <geoReference>, so every assertion about the element would have passed on a build that dropped it — the same shape as the omission #390 records. GW-2 gains steps 25-27 and two pass criteria: the world origin must come back from the file with the digits the user typed, and a workspace framed in one georeference must not be reused under another.
…324) The esmini smoke gate caught it on the committed sample: esmini v3.5.0 rejects the token outright — "Unsupported geo reference attr: +no_defs" — so every scene a user georeferenced would have carried something a major consumer refuses. 8.5's own example includes +no_defs, but the example is an illustration, not a rule about what a writer must emit, and the flag is a PROJ.4-era instruction not to read proj_def.dat — a file removed in PROJ 6. Dropping it costs nothing and buys back the consumer. The regression test holds both the generator and the committed samples to it: the generator assertion alone would not have caught the hand-written string in the sample.
The esmini gate earned its keepFirst push was 14/15 — esmini v3.5.0 rejects Fixed in The regression test holds BOTH, deliberately — the generator assertion alone TEST(TmercProjection, CarriesNoTokenAKnownConsumerRefuses)Sabotage-verified: putting Worth noting for #242 — this is the kind of thing only a real consumer finds, |
Closes #324.
p7-s5— the second sprint of P7, and the one the GIS/lidar/OSM imports needbefore they can reproject into anything.
What was missing
Georeferencing was completely greenfield, and
<header>leaked data both ways:<header>with four attributes. No children at all.parse_headerreadrevMajor/revMinorand walked no children, with no diagnostic for anything it dropped —warn_unsupported_root_childrenexplicitly excludesheader, so there was no header equivalent of the root sweep..xodrcarrying a<geoReference>.So a georeferenced foreign file lost its projection string silently. #453
(
fmt-f1) calls that "the most consequential item" on its list and defers thedecision to whoever models §8.5 — this PR, which is why it builds the whole
header-child dispatch and discharges #453's
<header>row.The decision worth reviewing: no PROJ
The issue said "PROJ enters as the reprojection dependency here." It is
deferred to #242 instead (maintainer decision at planning), because PROJ
drags in SQLite3 and a ~9 MB
proj.dbthat must be found at runtime, into akernel that builds from CMake alone and ships zero runtime data — to serve no
caller. Nothing in #324's acceptance needs a datum transform.
Instead the sprint authors the construction §8.5 itself recommends:
tmerc_projection(lat, lon)emits a TM centred on the scene's own origin with+k=1 +x_0=0 +y_0=0, so the local OpenDRIVE coordinates are the projectedcoordinates and nothing is ever transformed. A CRS RoadMaker did not author is
carried verbatim and reported as opaque —
tmerc_originanswers only for thatfamily, because guessing at a UTM zone's origin would be wrong by its 500 km
false easting. PROJ lands at #242 with a consumer that actually needs it.
What shipped
Layer 0 —
GeoReference/GeoOffsetonRoadNetworkbesideterrain_(same document-scoped, non-arena shape; default = absent = today's behaviour,
byte for byte). The reader models
<geoReference>/<offset>and preservesevery other header child and unknown attribute verbatim. The writer emits the
projection as the only CDATA node RoadMaker produces anywhere, the offset
only when it is not the identity, and derives
north/south/east/westfrom the network being written — never carried over from the input, which would
become a lie on the first edit. Two ASAM rule ids
(
header.proj.max_one_proj,header.offset.centered_coords) and one vendorrule (
header.georeference_mismatch).Layer 2 — a
workspaceblock in<scene>.rmscene.jsonholding the boxand the projection string it was framed in. A box framed under a georeference
the scene no longer carries is discarded with a diagnostic, per ADR-0008's
stale-sidecar rule. It carries its own double-width number formatter: the
camera's float path would lose a decimetre at UTM scale.
Editor —
Edit ▸ World Georeference…(a non-modal tool window, followingExportPreviewWindow; the editor still has zeroQDialogsubclasses),View ▸ Centre on World Origin, and the export preview's<header>read-out.Kernel/Python —
edit::set_georeferencewith an emptyDirtySet: ageoreference says how coordinates relate to the earth, not where anything is.
Bindings +
python/examples/world_georeference.py.Two things worth knowing
and that earns its keep immediately: the network can hold an identity offset
the file will not carry, and only the bytes know. There is a test for exactly
that case.
.xodrcarried a<geoReference>, soevery assertion here would have passed forever on a build that dropped the
element. Fixed with a georeferenced sample plus three corpus seeds, and
CommittedFixtures.*asserts against them.Sabotage matrix
Each neutered in turn, rebuilt, re-run — build exit code checked every time,
because two of these first failed to compile and would otherwise have "passed"
on a stale binary.
HeaderWriter.TheProjectionStringIsWrittenAsCdataonlyHeaderRoundTrip.TheGeoreferenceAndTheHeaderRemaindersAreAFixedPointonlymax_one_projguard never latchesHeaderGeoReference.ASecondDefinitionIsRefusedByRuleonlyHeaderWriter.TheBoundingBoxDescribesTheNetworkBeingWrittenonlyHeader.*tests + 162 existing round-trip testsWorkspaceMismatch.AWorkspaceFramedInAnotherGeoreferenceIsDiscardedonlySceneSidecarWorkspace.RoundTripsAtFullDoublePrecisiononlyTwo attempts (
if (false)on the guard, deleting theto_json_doublecall)failed to build under
-Werrorand were redone as runtime changes — asabotage that does not compile leaves a stale binary reporting green.
Verified
ctest --preset ci-macos: 2526/2526.pytest python/tests: 358 passed, 1 skipped.git ls-files '*.cpp' '*.hpp' | xargs clang-format --dry-run --Werror: clean.python/examples/world_georeference.pyruns end to end.Known limits, stated
is not an edit, the same rule the camera pose follows.
maintainer's gate.