Skip to content

Expose hov:lanes and hov:minimum as raw text - #139

Open
dsaderholm wants to merge 1 commit into
pfeiferj:mainfrom
dsaderholm:hov-lanes
Open

dsaderholm wants to merge 1 commit into
pfeiferj:mainfrom
dsaderholm:hov-lanes

Conversation

@dsaderholm

Copy link
Copy Markdown

Closes #130. Entirely reasonable to close this instead if it is not worth the maintenance — the coverage numbers below are regional and I said in the issue I would put it behind the overtaking work.

What it does

Passes hov:lanes and hov:minimum through untouched, in the same shape as maxSpeedConditional: read in the generator, stored on the offline Way, memoized on maps.Way, published on MapdOut. No lane indexing and no occupancy logic in mapd — whether an HOV lane may be used depends on occupancy, tolling and local rules, so consumers evaluate the tag themselves.

Two fields, not the directional variants

From taginfo:

hov:lanes                19,596
hov:minimum              12,215
hov:lanes:conditional     1,207
hov:lanes:backward          252
hov:lanes:forward           216

The forward/backward forms are about 1% of hov:lanes, so carrying them would cost every tile two more Text fields for almost nothing. Left them out, and hov:lanes:conditional too. Happy to add them if you would rather be symmetric with the maxspeed handling.

Format and coverage

Where the tag exists the HOV lane is the leftmost one — designated is the first entry on all 573 tagged ways I sampled on I-15 in Utah, and the pipe count always matches lanes.

I-15 Utah              1269 ways    45%
I-15 Arizona/Nevada     500 ways    22%
I-15 California         544 ways     0%

The California zero is not missing data: there the HOV lane is mapped as its own carriageway, so the matched way genuinely has no hov:lanes and the field is correctly empty. docs/outputs.md says so, since it would otherwise look like a bug.

Compatibility

Both fields are appended at the end of their structs, so tiles written before this read empty rather than failing. MapdOut's pointer count goes 6 → 8, which is the normal additive change.

Verification, including what I could not run

capnp 1.3.0 with capnpc-go v3.1.0-alpha.1. Before making any change I regenerated both schemas unmodified and confirmed a zero diff against the committed .capnp.go, so the generated output here is byte-comparable with yours rather than reformatted by a different toolchain version. The generated diff is the two accessor sets, the pointer count, and the embedded schema blob.

go build, go vet and go test were not run locally — gomsgq needs linux and cgo, and I wrote this on Windows. I verified by inspection that every generated symbol the hand-written code calls exists with the expected signature, and that the state.go call is the same shape as the SetRoadName line above it. CI covers the rest, and I will fix anything it finds.

I did not run gofumpt -w: with the current release it wants to rewrite files this PR does not touch, and I did not want to bury the change.

No test added, matching the existing conditional-tag accessors, which are also untested — the parser has tests because there is something to parse, and the point of this one is that there is not.

Happy to test a build on device.

🤖 Generated with Claude Code

Closes pfeiferj#130.

Both are passed through untouched, the same shape as maxSpeedConditional:
read in the generator, stored on the offline Way, memoized on maps.Way and
published on MapdOut. Whether an HOV lane may be used depends on occupancy,
tolling and local rules mapd does not model, so consumers evaluate the tag
themselves rather than mapd indexing lanes.

Two fields rather than the directional variants. hov:lanes is 19,596 objects
worldwide and hov:minimum 11,419, while hov:lanes:forward and
hov:lanes:backward are 216 and 252 -- about 1% -- so carrying them would cost
every tile two more Text fields for almost nothing. hov:lanes:conditional
(1,207) is left out for the same reason.

Where the tag exists the HOV lane is the leftmost one: "designated" is the
first entry on all 573 tagged ways sampled on I-15 in Utah, and the pipe count
always matches lanes.

Coverage is regional, and the docs say so. It is a US and Canada tag, and it
only describes roads where the HOV lane is a lane of the main carriageway. In
California the HOV lane is usually mapped as its own carriageway, so the
matched way carries no hov:lanes and the field is correctly empty there.

Adding the fields at the end of both structs keeps old tiles readable -- a way
written before this reads empty rather than failing.

Verified: capnp regenerated with capnp 1.3.0 and capnpc-go v3.1.0-alpha.1,
which reproduce the committed .capnp.go byte for byte on the unmodified
schemas before this change. The generated diff is the two accessor sets, the
MapdOut pointer count 6 -> 8, and the embedded schema blob. go build, go vet
and go test could not be run locally: gomsgq needs linux and cgo, and this was
written on Windows. CI covers all three.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

Expose hov:lanes and hov:minimum as raw text

1 participant