Repository navigation
Preparing support of turn restrictions (3): Import of turn restrictions - #135
Conversation
OSM relations of type "restriction" will be imported. According to the restriction type, several entries will be added to a turn cost table. Furthermore, the turn flag encoder is now implemented by the current edge encoders (e.g., foot flag encoder do not store any turn flags). Import can be enabled by GraphHopper#setEnableTurnRestrictions(true), which is disabled by default.
|
Thanks! Looks good! Some questions:
|
TurnEntryItem#getItemId() is faster now OSMTurnRelation#getRestrictionsAsEntries is not static anymore
|
I added a new commit with your desired changes :) |
|
Thanks! One major problem is the edgeOsmIds - this will either require lots of RAM or slow down the import if mmapped. I'll have to think about it. This is mainly the same problem we have for nodes and its mapped properties. But introducing another fat map for edges is not good as the node map is already around 8GB for the world wide case :( Hmmh, but there is another problem that there are more than one edge IDs for every way ID as the way will split at junctions and barriers. |
|
I've not fixed this problem but still you can "git cherry-pick" the one commit from my temporary issue_135 branch: https://github.com/graphhopper/graphhopper/commits/issue_135. I cannot push to your repo which would be necessary to list the commit here. Not sure why it is so complicated. |
|
I cherry-picked your commit, and I gave you the permission to push to my repo.
We definitely need to store the osmids for each edge to apply turn restrictions, since relations are always at the end of the osm file. However, maybe we could read out relations at first and in a second run we create nodes/edges and apply turn restrictions. In this case we only need to map edgeid->osmid for all osmids which have been found in relevant relations. This would slow down the import process due to reading the osm file twice, but should reduce the memory usage a lot on the other hand . What do you think?
Yep, because of this I map edgeid->osmid and search for the relevant edge later in getRestrictionsAsEntries using the edge explorer pattern. Or what do you mean? |
thanks
Yes, would be nice :) !
This should be okay - at least a lot better than storing every edge. And at some point in the future we re-code the whole import process to make this all a lot easier and probably file based, similar to what https://github.com/jillesvangurp/osm2geojson is doing (import all nodes and write a sorted file which mapes ID to json, the same for ways + relations).
ah, yes so this is okay. |
|
Would you mind to go ahead one more time and use the "double-parse" logic :) ? Would really appreciate it as there is another (big) problem for a pull request. |
|
there it is |
|
Wow, that was fast! I'll merge soon and test if a world wide import is possible. There is one minor thing which I will probably work on later: EncodingManager.analyzeTurnRelation has too many dependencies like the OSMReader and the GraphStorage and the EdgeExplorers. I would like to somehow avoid them there and move the parts more into the OSMReader. At least the OSMReader should move away as this is is "OSM stuff" whereas turn costs should be more generic. |
|
BTW: For which cases did you create the OSMRelationFactory? Ah and also the license header (+ @author in some cases) should be added to the new stuff |
Meeh, I'm not sure. Maybe I thought "that could be useful sometime", e.g. if other relation types should be processed. There is no particular reason. So if you want to kick it out, I'll do so. |
Yes, please :) ... although I think there is something in common with the relation stuff done for the bike route stuff and so something like this could be useful later. |
|
BTW: if you ever need to test real world turn instruction and need a nice overview, here I found one: http://map.comlu.com/ (zoom in to see what I mean) |
Preparing support of turn restrictions (3): Import of turn restrictions
|
👍 |
|
Hi there, I was reading the code regarding turn cost found at: I feel that there is something wrong with the criterion for inserting a Let be the following graph portion: w x we want to find shortcuts for contracting c. The criterion currently used is: I might be wrong, but I believe that there is a problem with this When computing a path, you actually arrive from an incoming edge, say I therefore believe that the criterion for adding a shortcut a-b when if This criterion is more expensive to compute, and I believe that it is Renaud De Landtsheer, Ir, Phd |
|
(question was answered on mailing list) I just wanted to test the memory behaviour of this feature and an error occured: |
OSM relations of type "restriction" can be imported. According to the restriction type, several entries will be added to the turn cost table. Furthermore, the turn flag encoder is now implemented by the current edge encoders (e.g., foot flag encoder do not store any turn flags) instead of additional turn flag encoders. Import of TurnRestrictions can be enabled by GraphHopper#setEnableTurnRestrictions(true), which is disabled by default and won't be considered by any routing algorithms yet.
The next step will be edge-based routing algorithms which are able to consider those restrictions.