You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Routing fails with hint pass_through and via points near dead-end ways or junctions #1258
When we match a point close to a dead-end, we will match it as Position.TOWER in the LocationIndex. We don't create VirtualNodes for TOWER QueryResults.
Fixing this seems not straight forward. We keep an unfavored flag for VirtualEdges in memory. Storing this for every edge might be too much?
Other possible but not optimal fixes could be:
Pass a list of EdgeIds to the weighting that contains unfavored edges, instead of storing the unfavored information in the edge. This might actually be slower than our current approach.
Create a VirtualEdge for TOWER nodes as well. I don't think that this makes sense to be honest :).
Don't throw an exception in QueryGraph#unfavorVirtualEdgePair, but just "fail" silently. The same happens already in QueryGraph#enforceHeading, where we just don't do anything if it's not a VirtualNode.
I think I would go with the "don't throw and exception" solution. It's a corner case and we should create an issue for how to handle edge unfavoring for non VirtualEdges. This can happen both for the heading as well as the pass through parameter.
changed the title [-]Routing fails with hint pass_through and via points near dead-end ways[/-][+]Routing fails with hint pass_through and via points near dead-end ways and junctions[/+]on Oct 24, 2019
changed the title [-]Routing fails with hint pass_through and via points near dead-end ways and junctions[/-][+]Routing fails with hint pass_through and via points near dead-end ways or junctions[/+]on Oct 24, 2019
Wouldn't the most general solution to this be that locations can't be on "real tower nodes", but only on links? (Think we've talked about this..) Like, just remove the special case where a point is snapped to a node instead of a link?
People don't live on intersections, they live at street addresses. Every routable location should be on a road, not on an intersection.
And suddenly, every location would have a heading. Not every location except those that were snapped to tower nodes.
Or put differently: Mathematically, the probability of a noisy point on a graph embedding falling on a node is 0. So we only create the special case by snapping it.
People don't live on intersections, they live at street addresses. Every routable location should be on a road, not on an intersection.
I think I agree and maybe we can get rid of some complexity if we can always assume that a QueryResult sits on a virtual node between tower nodes (basically always have Position.EDGE). But of course this solution just moves the problem to the location index lookup: we have to make sure that we always snap somewhere next to the node for cases where we snapped onto a node before (I think this applies for junctions just like it does for dead-ends). For junctions we even have to make a decision onto which of the adjacent edges we want to snap.
The thing that strikes me more here though is that for pass_through snapping onto a real node (a junction or dead end) is a special case (that we do not handle at the moment), but this is only a problem because of the way the feature is implemented. There is no real problem with this and it is clear what should happen also in this case. All we want is not take a u-turn at the via points so we start the next leg with an edge that was not the one we used to arrive at the via point. Ok for dead ends we indeed have to allow the u-turn in this case (because there is no other alternative). For junctions (in principle) this is not a problem at all.
I think just quitely ignoring it instead of failing the routing should be enough.
i think this approach is at least better than failing.
similar to how it's done in QueryGraph.enforceHeading: if (!isVirtualNode(nodeId)) return false;
After reading through these comments and the linked issues, I am still not clear whether the issue with the U-turn routing fails here was solved somewhere there in the meantime and whether it is save now to use the pass_through parameter.
Activity
karussell commentedon Jan 4, 2018
Thanks! Can reproduce it also on the current deployed version: https://graphhopper.com/maps/?point=51.451403%2C14.26778&point=51.450564%2C14.265726&point=51.450263%2C14.268236&ch.disable=true&pass_through=true
boldtrn commentedon Feb 13, 2018
I had a closer look what is happening here.
When we match a point close to a dead-end, we will match it as
Position.TOWERin the LocationIndex. We don't createVirtualNodesfor TOWER QueryResults.Fixing this seems not straight forward. We keep an unfavored flag for VirtualEdges in memory. Storing this for every edge might be too much?
Other possible but not optimal fixes could be:
QueryGraph#unfavorVirtualEdgePair, but just "fail" silently. The same happens already inQueryGraph#enforceHeading, where we just don't do anything if it's not aVirtualNode.I think I would go with the "don't throw and exception" solution. It's a corner case and we should create an issue for how to handle edge unfavoring for non VirtualEdges. This can happen both for the heading as well as the pass through parameter.
BTW: I pushed a test for this issue here
WDYT?
NopMap commentedon Oct 1, 2018
I think just quitely ignoring it instead of failing the routing should be enough.
easbar commentedon Oct 24, 2019
We have the same problem if a via point sits directly on a junction:
https://graphhopper.com/maps/?point=48.692337%2C9.118767&point=48.692013%2C9.122549&point=48.692363%2C9.129286&locale=en-US&vehicle=car&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale&pass_through=true&ch.disable=true
Taken from this forum discussion: https://discuss.graphhopper.com/t/node-id-must-be-a-virtual-node/4829/3
[-]Routing fails with hint pass_through and via points near dead-end ways[/-][+]Routing fails with hint pass_through and via points near dead-end ways and junctions[/+][-]Routing fails with hint pass_through and via points near dead-end ways and junctions[/-][+]Routing fails with hint pass_through and via points near dead-end ways or junctions[/+]Ignore silently non-virtual nodes for unfavorVirtualEdgePair, fixes g…
michaz commentedon Oct 25, 2019
Wouldn't the most general solution to this be that locations can't be on "real tower nodes", but only on links? (Think we've talked about this..) Like, just remove the special case where a point is snapped to a node instead of a link?
People don't live on intersections, they live at street addresses. Every routable location should be on a road, not on an intersection.
And suddenly, every location would have a heading. Not every location except those that were snapped to tower nodes.
michaz commentedon Oct 25, 2019
Or put differently: Mathematically, the probability of a noisy point on a graph embedding falling on a node is 0. So we only create the special case by snapping it.
michaz commentedon Oct 25, 2019
(My argument doesn't work that well for the dead-end case.)
easbar commentedon Oct 28, 2019
I think I agree and maybe we can get rid of some complexity if we can always assume that a
QueryResultsits on a virtual node between tower nodes (basically always havePosition.EDGE). But of course this solution just moves the problem to the location index lookup: we have to make sure that we always snap somewhere next to the node for cases where we snapped onto a node before (I think this applies for junctions just like it does for dead-ends). For junctions we even have to make a decision onto which of the adjacent edges we want to snap.The thing that strikes me more here though is that for
pass_throughsnapping onto a real node (a junction or dead end) is a special case (that we do not handle at the moment), but this is only a problem because of the way the feature is implemented. There is no real problem with this and it is clear what should happen also in this case. All we want is not take a u-turn at the via points so we start the next leg with an edge that was not the one we used to arrive at the via point. Ok for dead ends we indeed have to allow the u-turn in this case (because there is no other alternative). For junctions (in principle) this is not a problem at all.naser13 commentedon Apr 21, 2020
i think this approach is at least better than failing.
similar to how it's done in
QueryGraph.enforceHeading:if (!isVirtualNode(nodeId)) return false;NoamDev commentedon May 13, 2020
What about creating a virtual node "just before" the tower node (with weighting 0)?
Then, the problem for junctions will be solved.
NoamDev commentedon May 13, 2020
The problem wih dead-ends can be solved with edge-based routing, as I suggested in (#1765).
NopMap commentedon Apr 17, 2022
After reading through these comments and the linked issues, I am still not clear whether the issue with the U-turn routing fails here was solved somewhere there in the meantime and whether it is save now to use the pass_through parameter.
Can you enlighten me, please?
easbar commentedon Apr 17, 2022
Yes, it is safe to use.