Search code examples
gisopenstreetmaposrm

How does OSRM "nearest" method work?


I want to associate the coordinates and street name returned from the "nearest" method on the OSRM routing service with the source OSM Extract. I assume that OSRM create segments from all adjacent nodes in a way and snaps GPS coordinates to the nearest segment? Does it create segments by using geodesics between the coordinates of the nodes? I ask because I want to find the relevant section of the OSM and add some additional markup to the segment returned by OSRM.


Solution

  • Yes OSRM finds the nearest segment by computing the point-segment distance to the input coordinate. To make this scale we keep all segments in a R-tree.