I have a trace of GPS coordinates. I would like to get the OSM road ids of the roads that lie on the route defined by the coordinates.

I've used OSRM match service to match the coordinates to the road network. From the result I can get the individual node ids using annotations=true, but not the road ids. Should I somehow use the node id's to get the road ids, or is there some other way to achieve this?

bumped to the homepage by Community 5 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • It can't return the way IDs because your GPS trace doesn't have to pass along whole OSM ways but can use only part of these ways. So matching your trace to OSM ways means that you won't obtain a route but something like a tree instead with many branches. What is your ultimate goal? – scai Sep 27 '18 at 6:59
  • I understand that it does not pass along whole OSM ways, but I would still be interested in knowing the way IDs that the trace is on even for a short distance. My ultimate goal is to be able to pick the relevant roads from the OSM shapefile and save them to a separate shapefile. – poroale Sep 27 '18 at 7:30
  • 1
    Possible duplicate of Query for WAY that connects two INTERSECTIONS – mmd Sep 28 '18 at 15:14

You can use route-annotator, which was developed for use with OSRM, to look up way data given a set of OSRM-generated coordinates: https://github.com/mapbox/route-annotator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.