I have a list of (lat,lng) coordinates. I want to map match them and get their corresponding OSM node ids? How can i do that using OSRM or any other map matching algorithm?

  • Are you restricted to OSRM? I would rather use PostGIS for that, but I guess there are multiple possibilities ... – Jakob Miksch Dec 9 '19 at 8:19
  • 1
    in terms of pure availability, and only then usability, OSRM is the tool to use I'd say (I am biased towards OSRM, but there's Graphhopper as well!); there is no sophisticated map-matching algorithm implementation for the PostgreSQL/PostGIS/pgRouting environment. now, the OSRM project has plug&play docker container, as well as the overall very easy to use node.js bindings, including a very detailed documentation; where exactly are you stuck? – geozelot Dec 9 '19 at 9:38
  • 2
    (note that I refer to 'map-matching' as the algorithmic way to find a best-fit between a GPS track and a network, considering the spatio-temporal properties of both inputs. this is different from (or better: more involved than) simply finding the nearest OSM nodes/ways) – geozelot Dec 9 '19 at 9:44
  • 1
    'prophetic remarks' :-) well, to get results of the match API you need to feed it all GPS points (or at least a sequence)! go and read about map-matching (using the hidden-markov-model/chain and Viterby backtracing) to get familiar what OSRM actually does when you call the match API! however, when reading your other questions it may actually be possible that the OSM database has no mapped roads in your area, as suggested in the comments! please verify if the OSM data you use has the vector information of the road network you want to match against, or this endeavor is bound to fail! – geozelot Dec 9 '19 at 11:16
  • 1
    PostGIS can easily find the nearest node to your GPS points (note that OSRM has a nearest API to do just that!), but the nearest node does not necessarily need to be the one you expect! – geozelot Dec 9 '19 at 11:19

Your Answer

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

Browse other questions tagged or ask your own question.