Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a OSM-Shapefile containing all roads of a given area. I need an overlay cut out of this source-Shapefile that contains only some routes that I want to highlight on my map. I have some GPX-Tracks that show those routes, but they aren't precise enough to use them directly as an overlay. How can I use those GPX-Tracks to select the corresponding roads of the original shapefile, cut them out and copy them in a new shapefile? Is it possible to set a certain "buffer area" for selecting lines also if they don't exactly overlay with the GPX-file? I'm using QGIS normally, and possibly I'm searching for a opensource solution. Thank you!

share|improve this question
Which software are you working with? – Stefan Dec 12 '12 at 7:12
My normal workflow is QGIS, Globalmapper, Avenza Mapublisher (plugin for Adobe Illustrator) - but I would take every Opensource-Tool that can do this task. – Ralf Glaser Dec 12 '12 at 7:28
I dont have any idea how you do this in QGIS without PostGIS layer , but here is SQL select for it 'select * from roads as r , (select st_union(st_buffer(the_geom),10) as the_geom from gps ) as g where ST_Contains(g.the_geom, r.the_geom) IS TRUE' But that logic should return only and only roads that gps route follows. You can't use intersect or within because that will give you too many roads at road intersections. Value 10 in st_buffer should be little bit bigger than you highest value from distance calculation between gps point and closest road. This assumes that your data is good. – simplexio Dec 12 '12 at 8:42
Hello simplexio, thank you very much. Doesn't sound that easy... since I haven't yet experience with SQL - is there a way to do it in QGIS WITH a Post GIS Layer? – Ralf Glaser Dec 12 '12 at 8:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.