Repository navigation
Description
Open area routing lands in stages. This tracks what is knowingly left undone, so that none
of it has to be rediscovered from the diff.
Nothing here blocks #7161. The first group are defects in the snapping work that follows
it; the second are review points from #7161 that were answered with "later" rather than
with code.
Known defects
1. A table cell is wrong when only one of its two coordinates is on a plaza
Snapping a coordinate that lies inside an area charges the walk to the vertex against the
phantom's weight offset. The search seeds a source with the negation of that offset and a
target with the value itself, so the sign depends on which end of the journey the
coordinate is, and the snapping code is told which by its position in the coordinate list.
That holds for a route. In a table every coordinate is both. Coordinate 0 is the source
of row 0 and the destination of column 0, so one of the two is charged the wrong way round.
With m on a plaza and e off it:
| m → e | e → m | |
|---|---|---|
/route duration |
115.8 s | 79.8 s |
/table duration |
115.8 s | 51.2 s |
/route distance |
161.7 m | 161.7 m |
/table distance |
50 m | 250 m |
The distances are wrong both ways, because a table's distances are graph distances between
snapped points and never included the walk at all.
Cells with both ends on one plaza are correct, because those are computed from the
polygon rather than taken from the search, and they are the only ones the cucumber
scenarios assert.
The fix is to stop the approach cost being role-dependent: carry it on the phantom instead
of folding it into an offset. That grows PhantomNode from 80 to 84 bytes and
SegmentHint from 84 to 88, so ENCODED_SEGMENT_HINT_SIZE goes from 112 to 120 and the
hint string gets longer. Hints are already marked deprecated in include/engine/hint.hpp
and are invalidated by a data change in any case.
2. A trip whose coordinates all snap to the same vertex reports 0 m
On a plaza with nothing in it, several coordinates can share a cheapest way out, so they
all snap to the same corner. ShortestPathSearch over identical candidate sets returns a
result with no legs and is_valid() false, and /trip reports a tour of 0 m.
The geodesic pass cannot repair it: it rewrites legs, and there are none. A leg between two
coordinates on one plaza may have no graph path behind it at all, so this wants the route
to be built rather than corrected. The same coordinates on a plaza with an obstacle, which
makes them snap to different vertices, give a correct tour.
3. annotations=nodes is not stable at the ends of a route
The first and last entries of a leg's node list are read from the segment its phantom
sits on, not from anything the route travelled along. Two candidates can share a location
and differ in segment id, since a coordinate snapping to a junction projects onto every way
meeting there. Which one is reported then depends on the order the search settled nodes in,
and CH and MLD do not always agree. The geometry, distance and duration are identical; only
the node ids differ.
The mechanism is general and predates this work. Area snapping makes it common, because it
offers a candidate per direction leaving a vertex on purpose, and for a leg that the engine
writes itself those terminal ids name a way the route never uses.
Consumers who need to know where a route began should read the waypoint. Fixing it properly
means either having a leg carry its own terminal node ids or leaving them out of the
annotation for such legs, which changes the array's length.
4. /match does not use the geodesic
/route, /table and /trip now agree about a journey with both ends on one plaza.
/match was not considered.
Deferred from review of #7161
process_areain the profile API (review comment). The current flow registers
areas fromprocess_wayandprocess_relation, which reads oddly. A dedicated
process_areawould be cleaner and is a profile API change, so it wants its own
discussion.index_priority_queueversusquery_heap(review comment). The area code
carries its own priority queue. Either it should say in the header whyquery_heapdoes
not fit, or it should use it.- Haversine in the mesher.
AreaMesher::run_dijkstraweights edges with
boost::geometry::distance, which on these coordinates yields an angle rather than a
length. Only the ratios matter to Dijkstra so the routes are right, but replacing it with
coordinate_calculation's haversine interacts withDijkstra::distance_epsilon, which is
absolute. Seedocs/areas.md. - More kinds of entry point (review comment). Bridges, tunnels and stairways that
start in the middle of an area, and possibly named POIs, are not entry points today. - Two conventions for
a:nodes. feat: open area routing #7161 changes the route step to render node names
instead of raw ids, because meshing creates virtual nodes whose ids move whenever the mesh
changes.features/step_definitions/matching.jsresolves the same column by its own path
and was not changed, so four cells infeatures/testbot/matching.featurestill assert
numeric ids. Either finish the conversion or record why match assertions keep ids.
Activity
feat(area): route across pedestrian areas by meshing them (#7161)
DennisOSRM commentedon Aug 11, 2026
The work these come out of is now open as three stacked PRs:
Defects 1 and 2 above are visible once #7686 lands. Defects 3 and 4 are visible after #7685.
DennisOSRM commentedon Aug 11, 2026
Two more limitations, both surfaced by running the branch with assertions on (
ENABLE_ASSERTIONS, which theclang-20-debug-covjob builds with).A via point inside an area goes uncharged. The walk into an area is folded into the phantom's weight offset, and the search seeds a source with the negation of that offset and a target with the offset itself. A via point is both ends at once, so no single value is right for both, and charging it as a departure makes the leg arriving there seed a negative key, which CH asserts against. It is now charged nothing, which costs a little accuracy on the legs either side. A trip is the same case for every one of its coordinates, since the tour returns to the first, so
/tripcharges no approach walk at all. The fix is the same as for defect 1: carry the approach cost on the phantom instead of folding it into an offset.A leg written from the polygon is named after a way at its endpoint.
/routereports the step across a plaza as being on whichever way met the vertex the search snapped to, not on the plaza. This is the same root cause as defect 3: a synthesised leg has no way of its own, and everything about its identity is borrowed from the phantom that happened to match. Giving such a leg a coherent identity would fix the name and the terminal node ids together.DennisOSRM commentedon Aug 11, 2026
All four PRs have landed on master:
Everything recorded here is still open. The next piece of work is carrying the approach cost on
PhantomNoderather than folding it into a weight offset, which fixes defect 1, the uncharged via point and the uncharged trip in one go. It growssizeof(PhantomNode)from 80 to 84 bytes andENCODED_SEGMENT_HINT_SIZEfrom 112 to 120, so the public hint string gets longer.DennisOSRM commentedon Aug 11, 2026
Two corrections to what is written above, both found while doing this.
The hint does not have to grow. Defect 1 says the fix costs a longer public hint string, 112 to 120 characters. That was true when it was written and is not any more: #7649 replaced the
PhantomNodeinsideSegmentHintwith a fixed 80 byte placeholder, sosizeof(PhantomNode)and the hint are no longer connected. #7688 grows the phantom from 80 to 92 bytes and the hint stays exactly as it is.The sign is only half of defect 1. #7688 moves the approach cost onto the phantom, so it is added in either role and nothing has to know which end of a journey a coordinate is in order to cost it. That fixes the via point and the trip. It does not fix a table cell with one end on a plaza, and the reason is worth recording, because it is not what the description above says.
A candidate departed from stands at an edge-based node's start; one arrived at stands at its end. A coordinate that is both can only have one shape. When the departing shape is used as a target it sits before a source that is further along the same node, and the cell comes out short by the stretch in between:
The many-to-many code does have a guard for that degenerate case,
addLoopWeight, but it fires on the accumulated weight going negative, and a positive approach cost masks it. So finishing this needs two things rather than one: a candidate that carries both shapes, and a degenerate-path test that knows the approach walk is not part of the graph cost.refactor(engine): carry the approach cost on the phantom, not in its …
refactor(engine): carry the approach cost on the phantom, not in its …
refactor(engine): carry the approach cost on the phantom, not in its …
fix(engine): a table cell with one end inside an open area came out s…
fix(engine): a table cell with one end inside an open area came out s…
DennisOSRM commentedon Aug 13, 2026
Defect 1 is fixed by #7689. A table cell with one end on a plaza now agrees with
/routein both directions.The cause was not the sign, which #7688 had already dealt with. A target that sits before the source on one edge-based node is unreachable that way and needs a loop to get to. The weight going negative is what says so. The walk into an open area is charged at both ends and is not travel, so it lifted the sum back above zero and the degenerate pairing was accepted. Both many-to-many implementations now carry how much of the weight is that walk and test the graph part.
The both-shapes candidate discussed above turned out not to be needed. With the loop test corrected, a candidate used in the role it was not shaped for gives the right answer, because the loop supplies the missing stretch. I built it, found it had no effect, and removed it.
Still open here: defect 2, the trip whose points all snap to one vertex; defect 3, node annotation stability; defect 4,
/matchnot using the geodesic; and the deferred review points from #7161.DennisOSRM commentedon Aug 13, 2026
One more, found by review on #7689 and out of scope there.
many_to_many_ch.cpp, the loop-adjustment branch, has been this way since 2017:The three metrics take their minimum independently, so a cell can end up with the weight of one candidate path and the duration of another. The middle node is then written whether or not anything improved. The branch below it does the same update as a single comparison on the tuple, which is what this one should probably do too.
feat(profiles): make walking paths on squares an opt-in flag in foot.…
fix(guidance): widen EntryClass so a plaza vertex can report its roads
feat(area): add the elastic band as a standalone geometry module
10 remaining items
feat(area): add the elastic band as a standalone geometry module
fix(extract): remove stale open-area files when the profile meshed no…
feat(area): simplify plaza outlines at extraction, by Visvalingam-Whyatt
fix(guidance): widen EntryClass so a plaza vertex can report its roads
fix(extract): remove stale open-area files when the profile meshed no…
fix(guidance): widen EntryClass so a plaza vertex can report its roads
feat(area): simplify plaza outlines at extraction, by Visvalingam-Whyatt
feat(area): simplify plaza outlines at extraction, by Visvalingam-Whyatt
fix(guidance): widen EntryClass so a plaza vertex can report its roads
feat(area): simplify plaza outlines at extraction, by Visvalingam-Whyatt
fix(guidance): widen EntryClass so a plaza vertex can report its roads
fix(extract): remove stale open-area files when the profile meshed no…
fix(guidance): widen EntryClass so a plaza vertex can report its roads
feat(area): simplify plaza outlines at extraction, by Visvalingam-Whyatt
fix(area): try every area holding a coordinate, not just the first (#…