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?

asked 08 Nov '14, 06:46

leonid's gravatar image

accept rate: 0%

edited 11 Nov '14, 06:56


This kind of problem is called "matching" and is adressed by various approaches:

permanent link

answered 08 Nov '14, 13:55

iii's gravatar image

accept rate: 10%


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 ♦

Please don't reply with lmgtfy-type sites. This is help.osm.org, not snarky.osm.org.

(11 Nov '14, 10:05) Richard ♦

I'm sorry, my intention wasn't to blame anybody. I just thought that @leonid didn't had an idea on what he is looking in detail (as he didn't provided further infos about his usecase).

(11 Nov '14, 18:22) iii

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.

permanent link

answered 11 Nov '14, 10:08

Richard's gravatar image

Richard ♦
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 08 Nov '14, 06:46

question was seen: 5,498 times

last updated: 11 Nov '14, 18:22

powered by OSQA