How I can delete points along a line, with a distance tolerance?

As you can see in the figure, the points near the line should stay, the points between the lines should be deleted.



3 Answers 3


There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer....

Let's assume we have the following layers 'points_along' and 'lines', see image below.


With the following query, it is possible to extract only those points that are within a distance tolerance, in the case below 100m were used.

FROM "points_along" AS p, "line" AS l
WHERE ST_Length(ST_ShortestLine(p.geometry, l.geometry)) < 100

The output Virtual Layer with its Attribute table will look as following


  1. The easiest method would be to build a buffer first with Vector -> Geoprocessing tools -> Buffer
  2. Then delete all the points within that buffer with Vector -> Geoprocessing tools -> Difference.

A solution based on QGIS expressions: Use select by expression with this expression (changing the distance in line 5), then delete the selected points:

disjoint (
    buffer (
        overlay_nearest ('line',$geometry)[0],
        40000  -- change distance here

Red buffers for visualization purpose only: yellow points are selected by the expression from above: enter image description here

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.