I have a bunch of GPS tracks. I want to exclude the ones which go via public roads. I'm interested in off-road segments only. Is there any public api to check if a given set of coordinates belongs to a road or street? Is there a better way to do it? Perhaps OSM?

Some context - the tracks are in UK. I'm comfortable with programming in C#/F#. I'm thinking of writing a piece of code which will filter the tracks. Computing power is limited to a single awerage PC.

  • You could buffer a roads layer and take out any points inside the buffer. – JasonT May 7 '15 at 14:17
  • I guess I can source it from OSM, right? I'm new to GIS. – Pasho May 7 '15 at 14:26
  • Welcome to GIS SE. Please edit some extra info into the body of the question for clarification, e.g., your note on OSM; what software restrictions do you have; and what part of the world are you in? – Martin F May 7 '15 at 14:53
  • 1
    @MartinF updated! – Pasho May 7 '15 at 15:39
  • What is a public road exactly? – scai May 8 '15 at 6:39

I think JasonT is on the right track (excuse the pun). Note, however, it is the concept of a buffer that you want, not to actually create a buffer. If you were using PostGIS (or similar software/libraries), you'd use ST_DWithin() to reject public road points that are too close to your GPS points.

  • Sorry it is only a partial answer, but i think it's better not to put it in a comment. Or maybe it should just be a comment. – Martin F May 7 '15 at 17:17

Google maps roads API can do that, if a non-OSM solution is ok with you.

See snapToRoad method which returns the GPS points snapped to the nearest Road. You can take the place id from the response and use Google Maps Places API to get corresponding Road name.



So after some research I decided to stick with the OSM metadata. I found the Overpass API, which is basically a query language, which I managed to understand reading this:


and testing it here


I ended up with this query:


This finds all the roads I considered public using a highway filter within my bounding box. Then takes those ways and loads their nodes - (._;>;); - such an obvious statement, isn't it!

This gives me the necessary metadata to use for filtering. Now I can construct geometries and intersect with my tracks using .Net Topology Suite


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.