Repository navigation
feat(highways): scale road width with lane count - #1104
Conversation
Vehicular roads now derive width from the OSM lanes=* tag at the standard 3.5 m/lane (lanes is the total for both directions), never narrower than the per-type default, so multi-lane arterials are visibly wider than a 2-lane street instead of all sharing one fixed width. width=* still wins, and the result is clamped to MAX_BLOCK_RANGE. tertiary widens 5 -> 7 m via its 2-lane default. Untagged and 2-lane roads keep their current widths.
There was a problem hiding this comment.
Pull request overview
Updates the highway renderer so vehicular road widths can scale with the OSM lanes=* tag (3.5 m/lane), while preserving existing defaults for untagged and 2‑lane roads and keeping width=* as the highest-precedence override (clamped to MAX_BLOCK_RANGE).
Changes:
- Introduces a
lanes_scale_widthflag per highway type to apply lane-based widening only to vehicular roads. - Parses and caps
lanes=*, derives a lanes-basedblock_range, and applies clamping consistently. - Simplifies the old “other highway types” special-casing so residential/unclassified/etc. are handled by the unified lane-based logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
⏱️ Benchmark run finished in 0m 51s 📈 Compared against baseline: 18s time, 1005 MB memory 🟢 Generation time is unchanged. 📅 Last benchmark: 2026-06-16 08:57:54 UTC You can retrigger the benchmark by commenting |
Address PR review: the prescan/bridge consumers call highway_block_range, which had diverged from the renderer's new lane-scaling, so road masks and bridge widths disagreed with the rendered road. Move the full width logic (per-type base, lanes scaling, width=* precedence, clamp) into highway_block_range and have the renderer call it, so they can't drift. width=* now tolerates a trailing "m" (reuses the shared width parser), and a unit test covers the lane/width cases.
Vehicular roads now derive width from the OSM lanes=* tag at the standard 3.5 m/lane (lanes is the total for both directions), never narrower than the per-type default, so multi-lane arterials are visibly wider than a 2-lane street instead of all sharing one fixed width. width=* still wins, and the result is clamped to MAX_BLOCK_RANGE. tertiary widens 5 -> 7 m via its 2-lane default. Untagged and 2-lane roads keep their current widths.