[GraphHopper] OSM tags extraction

Martin Malfertheiner martin.malfertheiner at gmail.com
Tue Aug 25 15:49:56 UTC 2015


Hi,

I’m working on an extension of the routing engine. My goal is to map a gpx track to a osm track and then extract all osm data of the resulting track. Right now I get only the distance, speed and points of an edge, but I would like also to know the osm tags such as surface, highway,… of each edge. Is there already something in place which can deliver this information or do I have to program it on my own? Can you maybe give me some hints.

example:

GPXFile gpxFile = new GPXFile().doImport("./track-data/Garmin_150704_Seis_Konstantin.gpx");
List<GPXEntry> inputGPXEntries = gpxFile.getEntries();
MatchResult mr = mapMatching.doWork(inputGPXEntries);

// return GraphHopper edges with all associated GPX entries
List<EdgeMatch> matches = mr.getEdgeMatches();
// now do something with the edges like storing the edgeIds or doing fetchWayGeometry etc
for(EdgeMatch match : matches) {
    long flags = match.getEdgeState().getFlags();
    PointList geometry = match.getEdgeState().fetchWayGeometry(3);
    //System.out.println(geometry);
    System.out.print("Distance: " + match.getEdgeState().getDistance() + ", Points per edge: " + geometry.size() + ", Speed: " + encoder.getSpeed(flags) + ", Turn cost: " + encoder.getTurnCost(flags) + ", Is forward: " + encoder.isForward(flags) + "\n");
}
Thats all the infos I found so far about an edge. Is OSM data also stored somewhere?

All the best,

Martin
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150825/08d25308/attachment.html>


More information about the GraphHopper mailing list