Closed NouraKar closed 8 years ago
Those edges are edges from GraphHopper. While import you can create a separate long-array which maps GraphHoppper edgeIds (the index of the array) to OSM way Ids (of type long). E.g. have a look into the postProcessing hook in the GraphHopper class. There is no built-in mechanism yet to do this, also separate tags etc needs to be stored in your own storage somehow.
Thanks for answering. I had a look on the postprocessing method in graphhopper class i couldn't get, how can i access the edgeID there or the wayID of the OSM? and if i can access them some how should i return the mapping array that you have mentioned above? could you please give me some more details? i'm kind of stuck here. Thanks in advance.
I am facing the same problem with graphhooper and OSM. I cannot map the edge ID with way ID. @NouraKar Did you find any solution ? @karussell Could you please help us here as you are the most expert one
Thank you all in advance :)
Due to the lack of my time I won't be able to implement this soon, but it is not that hard. E.g. overload the GraphHopper class to inject your custom OSMReader. For this reader collect all OSM way ids in an array with the size of the edge count. Something like this:
class MyGH extends GraphHopper {
protected DataReader createReader( GraphStorage tmpGraph )
{
return initOSMReader(new MyOSMReader(tmpGraph));
}
}
class MyOSMReader {
long nodeArray[];
protected void finishedReading() {
nodeArray = new long[graphStorage.getAllEdges().getCount()];
loop through osmNodeIdToInternalNodeMap -> entry
{
nodeArray[entry.value] = entry.key;
}
super.finishedReading();
}
public long getOSMNodeForGHId(int ghId) {
return nodeArray[ghId];
}
}
Then, after import you can read from the freshly filled nodeArray. But to make it also available after load without import you have to store it in finishedReading. E.g. use a DataAcess and do nodeArray.flush().
And the edge mapping between OSM and GH can be achieved similarly.
See here for the necessary code: https://discuss.graphhopper.com/t/osm-way-id-mapping-making-integrating-external-data-easier/171
and let me know if this does not fix your problem
Hey,
I'm new to graphhopper and i'm using this map matching master to match some GPX data. I want to get the OSM wayID or nodeID of the matched result but it seems that the results is list of matched edges. I don't really understand what are those edgeID, what do they represent in Open street map?
Thanks for help.