GraphHopper.com | Forum | GitHub | Maps | Blog

Mapping OSM way id to internal edge graph identifier


#1

What is the best approach to get a mapping between OSM way ids and internal edges ids?

I need to map OSM way ids to the ids returned from the edgeState.getEdge() method. would that be possible?

thanks!


#2

I just went through the same process. The best links that describe all that you need to know are found at the following links. When creating the graph an edge_mapping is created that links an edge with an OSM Way ID. You then can retrieve the Way ID at a later point from the Edge.

The discussion that describes this problem and how it might be improved upon - https://github.com/graphhopper/graphhopper/issues/917
The source code for encoding the OSM Way IDs and retrieving them (also handling virtual edges) - https://github.com/karussell/graphhopper-osm-id-mapping

As an aside the next thing you probably will want to solve (getting the edges in a route) is found at this link.