-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn-Restrictions with via ways #2681
Comments
The aim of this discussion ticket was to have a full overview of the different cases. Without the discussion we had, I don't think that anyone else can follow along the implementation. We have to flesh out this issue so the approaches are clear. |
The problem statement can be described with the figure where relation:restriction has way members One possible and straightforward approach is to modify graph creation during the extraction stage and do not include edges that are in restricted paths. This will require an addition of artificial edges for allowed paths. There are some problems besides the big number of additional edges for multi-via restrictions:
Another solution proposed by @MoKob is based on removing shortcuts that correspond to restriction relations. The steps are:
For example, for the restricted path a-r-c, nodes 3 and 4 must be contracted before 1, 2, 5, 6 Let say 4 is already contracted. Contraction of 3 without witness paths will create shortcuts The problem may occur when the core size is small and a restricted path is not contracted, so internal nodes of restricted relations must be contracted prior to other nodes and must be in the core. Also contraction of overlapping restrictions, like with two restrictions e-a-r and a-r-c that have overlapping edges a and r must be handled correctly. |
In the lights of having MLD around, we need to rethink how we want to handle these types of restrictions. Reducing via-ways to via-nodesAny via-way restriction can be reduced by one in length by replicating some edges and forbidding turns. For example on a one-way restriction, we could add additional edges for all allowed final steps and only allow turning onto them at the first node. A restriction of This approach does not scale well with multi-hop restrictions, as the number of edges we need to add grows exponentially. The number of long multi-hop restrictions should be small, though. The obvious benefit of this approach is that it should work both on MLD and CH.
CHfor the CH, the above considerations should still hold true. MLDOn MLD we could make our base algorithm aware of turn restrictions. As long as we ensure via-ways don't cross border nodes, we could make the base level customisation aware of turn restrictions, just as the unpacker. This would require a deeper state for the search algorithm, though, and potentially multiple different sources a node can be reached from. E.g. in the above example we would need to be able to reach From the current point of view, I would suggest biting the sour grape and to replicate edges in the graph. Most restrictions should be easy enough to get away with a few edges only. We could start of doing single way restrictions and handle these. |
@oxidase I've done some small visualisation to capture what I was talking about before on the call: As you can see, we require an additional weight for every node based on a possible history. This kind of method is impossible on CH, since we do not have access to the search history in full. Ways this could be implemented in MLD do not strike me as favourable, since we would need to be able to access search history of edges hidden in the overlay, whenever a turn is part of a cell border. We would require storing the last We would have multiple weights for any node (even though it would be enough to store these for every node that is part of a via-way turn restriction) making the search more complicate. Will have to give it a bit more though, before I can really say what each approach would fully entail, though. |
A few years ago I implemented support for this in a Contraction Hierarchies based pather. My approach was to pre-process the map, replacing each node of the graph with as many NodeAndState objects as there were states relevant to passing through the node. The state I tracked included the set of turn restrictions that were active. So for example if there was a turn restriction A->B->C, you could be at node B with the turn restriction active, if you'd arrived from A; or if there was some other way to reach B there would be another NodeAndState without that turn restriction active. (I also used the NodeAndState to keep track of U-turns, use of private roads and suchlike) Once I'd figured out every NodeAndState it was possible to access and the connections between them, the result was a graph that Contraction Hierarchies would work on just fine. Anyway, here's my point: You don't have to store a long history just in case there's a long turn restriction - by preprocessing you only need complicate the graph when there are actual turn restrictions that can really be active. Of course, we can imagine degenerate cases (a huge grid with a hundred turn restrictions per node) but I haven't seen any in the OSM data I've looked at. |
Based on @michaeltandy suggestions, I've drawn up this sketch for duplicating edge-based nodes. This still duplicates edges / nodes, but looks conceptually well suited for implementation on top of the edge base graph factory. We would require to do the following:
The result is essentially the same as in #2681 (comment), reducing the restrictions from via-ways to via-nodes, but conceptually easier, since we don't do it in the node-based graph generation but rather in the edge-based-graph generation. |
On challenge here: conditional via-way restrictions. We currently do not offer any way of detecting these turns onto parallel ways. |
Basic support for turn restrictions with via ways has landed with the OSRM 5.10 release. |
Conditional restrictions with via ways landed in OSRM 5.11. Closing here, woo! |
@danpat can you branch out a ticket for multi-via-way restrictions? |
Outcome of discussion with @MoKob:
Tagging scheme of osm restrictions using ways http://wiki.openstreetmap.org/wiki/Relation:restriction#Prohibitory_restriction
OSRM does not handle restrictions ways with via role and
ignores via.way restrictions in RestrictionParser parser
at https://github.com/Project-OSRM/osrm-backend/blob/master/src/extractor/restriction_parser.cpp#L168-L172
For example, in germany-latest there are 1404 such relations with 1331 (95%) one-via-way relations
relations.txt
Possible approaches and their respective drawbacks:
For future work:
Related issues:
#483 relation http://www.openstreetmap.org/relation/2339761 has a via node restriction and will not be affected by the change
#2634 https://www.openstreetmap.org/relation/6187972 has one via way restriction and must be fixed with the first step
#1828 looks like an implementation of the first approach
/cc @MoKob
The text was updated successfully, but these errors were encountered: