I need to identify the road (or, more precisely, the sequence of road segments) that a GPS track is following. I can see how to implement this through low-level methods - find closest segments for each point on the track, then clean up the results - but maybe this is already implemented somewhere? |
One simple possibility is to use routing software, such as OSRM, to find a route between a series of via points taken from your GPS track. You could take a point from your track every 2km, and add a via point at that location. Then call OSRM's viaroute function to get a route back which will follow OSM data between those points. To make the route more faithful, you could replace "every 2km" with a shorter interval, or add some logic to add a via point whenever the track goes round a sharp corner. OSRM will return turn-by-turn directions for the route, plus a polyline. If you want the exact OSM IDs, you can run your own instance of OSRM and adapt the car.lua profile code to return OSM IDs as part of the road name. |
This kind of problem is called "matching" and is adressed by various approaches: 2
I suspect that the OP was perfectly capable of doing a web search and was rather hoping for personal recommendations of what works and what doesn't in particular circumstances...
(08 Nov '14, 13:59)
SomeoneElse ♦
1
Please don't reply with lmgtfy-type sites. This is help.osm.org, not snarky.osm.org.
(11 Nov '14, 10:05)
Richard ♦
|