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
// note that the u-turn costs overwrite any turn costs set in TurnCostStorage
tCost = uTurnCosts;
... but that does not really make any sense? I think I put this comment there, but only because historically we always did it like this, probably because at one point we had several different 'u-turn' TraversalModes...
It is probably only a matter of reading the turn costs from storage and checking if there is a restriction, before returning the default u-turn costs in the code I linked above. This might cause a slow down of the routing though, because the u-turn costs will be read at every node.
The tricky question here is probably what should be returned if there is no restriction, because then we still cannot tell if this is a u-turn we rather like to avoid or one that is perfectly fine. To me it seems like it would be much more useful if there was an OSM tag that explicitly marks junctions with reasonable u-turns.
what should be returned if there is no restriction
I'd suggest just returning the default value from the profile if there's no restriction. It will make routing with u-turns usable without waiting for worldwide adoption of the new OSM tag (it can take years lol).
we still cannot tell if this is a u-turn we rather like to avoid or one that is perfectly fine
Maybe some configurable country-specific rules could be useful, taking into account road classes, other restrictions (left turn), etc. But that's another question.
Activity
easbar commentedon May 3, 2022
This is because the global u-turn costs overrule those set in the turn cost storage:
graphhopper/core/src/main/java/com/graphhopper/routing/weighting/DefaultTurnCostProvider.java
Lines 68 to 70 in 9f429cb
... but that does not really make any sense? I think I put this comment there, but only because historically we always did it like this, probably because at one point we had several different 'u-turn' TraversalModes...
Arcturuss commentedon Jun 12, 2024
Any new info or progress on this? Maybe someone could explain how it can be fixed?
easbar commentedon Jun 12, 2024
It is probably only a matter of reading the turn costs from storage and checking if there is a restriction, before returning the default u-turn costs in the code I linked above. This might cause a slow down of the routing though, because the u-turn costs will be read at every node.
easbar commentedon Jun 12, 2024
The tricky question here is probably what should be returned if there is no restriction, because then we still cannot tell if this is a u-turn we rather like to avoid or one that is perfectly fine. To me it seems like it would be much more useful if there was an OSM tag that explicitly marks junctions with reasonable u-turns.
Arcturuss commentedon Jun 13, 2024
I'd suggest just returning the default value from the profile if there's no restriction. It will make routing with u-turns usable without waiting for worldwide adoption of the new OSM tag (it can take years lol).
Maybe some configurable country-specific rules could be useful, taking into account road classes, other restrictions (left turn), etc. But that's another question.