2

In QGIS 2.18.16

I have 2 layers, one is for points with information about an accident and the other layer is a line string that represent "the road that I take care off".

I want only to extract or filter the information of points of an accident (yellow dots) that happen in the road that I take care off (blue lines).

I try with the "Joint attributes by location" tool but it doesn't work.

Please help!

Yellow dots are accidents and blue line is the road that I take care off

2 Answers2

1

If the points don't "sit" directly on the line, the software may not pick up the spatial relationship of the point to the line. Here are possible options, all involve a polygon.

Try creating a buffer of the road. Not too big, maybe estimate the average width of the roads you "are in charge of" - ie: 5m for a standard road. You can now run a few tools to identify the points in / along your route.

QGIS has under "Vector -> Research Tools" a "Select by location" Tool. You can use this to select out the points which intersect / are within the buffer you have created. You can create a new point layer from this selection. enter image description here

There are quite a few other tools in the "Vector" drop down, "Data Management Tools" and "Analysis Tools" all have options to interrogate the relationship of points and polygons.

Keagan Allan
  • 3,706
  • 1
  • 15
  • 25
  • Thank you for the support. I create the buffer on the road, around 30 meters. After I use "Intersection" tool located in Vector > Geoproccesing tool. The intesection was between the points vs the buffered road. – CESAR AVILA Mar 15 '18 at 14:20
1

Alternately, you can try to use the NNJoin plugin - it finds the closest line to every point and outputs a copy of your point shapefile with all of the attributes of the closest lines added (e.g. the name of the closest line and the distance to it).

miln40
  • 1,111
  • 12
  • 20
  • You would need a road layer that has all the roads in the area. Then filter the result based on road name. – csk Apr 05 '18 at 19:52