How do I create an attribute list from points that run along roads in a shapefile containing road data?

The points don't intersect the road centre lines and are not consistent in their distance from the roads.

  • 6
    Sounds like you need to decide how far from the road you will consider "along" it. Then run a buffer on your road feature and select points using that. Both functions are found under the vector menu, under Geoprocessing Tools and Research Tools, respectively.
    – ako
    Commented May 3, 2013 at 6:38

2 Answers 2


If you want to bring both the points and the roads into a spatialite database, then you can use the ST_Distance function to find points within a certain threshold from the roads:

FROM points AS p, roads AS r
WHERE ST_Distance(r.geometry, p.geometry) < threshold
GROUP BY p.id;

(The GROUP BY will insure that if a point is within the threshold distance to two different roads - at an intersection for example - then it will appear only once)

  • This is of course assuming they have a PostGIS (or other enterprise DB set up that supports OGC compliant queries) that they are querying the data from. This query wouldn't be possible with, for example, shapefiles. Commented Aug 3, 2013 at 1:45
  • Using spatialite it's certainly possible.
    – Micha
    Commented Aug 3, 2013 at 16:29
  • Sorry that I didn't notice the spatialite reference. Thanks for pointing is out. Commented Aug 4, 2013 at 17:51
  • If shapefile is the only format you Can use, You Can run this kind of SQL spatial queries on shapefiles using virtual layers in Qgis.
    – YoLecomte
    Commented Apr 24, 2018 at 6:37

Like ako's suggestion but with a twist, another approach would be to make a points layer with points at regular intervals along the road centerline, say 20m apart. (aka 'Chainages' - or 'Linear Referencing'). Then buffer those points to a diameter of say 19 or 19.5m or so, as large as you can without quite touching each other. The new points you want to identify can then also be buffered at around 4 or 5m diameter circles, sized so they cannot quite fit within 20m either side of your centerline without intersecting at least one of the centerline point buffers, or chainages. The chainage points layer should contain the road name and number and of course the chainages, so when you join those two layers you end up with a new layer with just your new points and with the road name, number and chainage (distance) to identify each of the new points. The new points could be the positions of geotagged photos of road sign or culvert headwalls or whatever other things you might find beside the road that may need documenting. The photo2shape plugin in QGIS is great for importing geotagged photos into a shapefile as a points layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.