Is there any way in QGIS to delete vertices in an automatic way from a feature which are coincident with a point layer?

I have many lines forming a "T shape", so I would like to remove the middle vertex of the horizontal line so the only vertex there is the first (or last) one from the vertical line. Every line has a different length, so it's not possible to smooth or simplify the feature.

  • If the 'top' of the T is a straight line, then the middle vertex is an unnecessary vertex. You might be able to solve your problem with an 'remove unnecessary vertices' tool.
    – Martin
    Apr 16, 2020 at 13:53
  • The truth is that this could work... Thank you!
    – Noe
    Apr 17, 2020 at 10:26

2 Answers 2


Extract the vertices of the line and than delete all the vertices that are very close to one of the points. Than re-connect remaining vertices to a line again.

Your line layer needs an attribute with a field containing unique values, in my case id. Layer names: lines (black line on the screenshot below) and points (red dots). Change all these names accordingly. The overlay_nearest function is available since QGIS 3.16, see visual changelog. For older versions, use the refFunctions plugin.

How you do it:

  1. Menu Vector / Geometry tools / Extract vertices: white dots

  2. On the resulting layer from one, select features using the toolbar icon select by expression with this expression. It looks for the nearest feature from the layer points and if the distance is smaller than 0.1, it is selected (in fact, distance should be 0 - but to be sure in case of rounding errors, set a minimal distance):

distance (
    array_first ( 
) <0.1
  1. Delete the selected points (yellow in the screenshot).

  2. Menu Processing / Toolbox / Points to Path to re-connect the remaining points: for sorting, select the field vertex_index, for grouping select id. You get the blue line, corresponding to the original, black line, minus the vertexes where your have red dots.

enter image description here

The result looks like this. Be aware that the topology changes: on the T shape at the right, be deleting the vertex where both lines meet, being in the same time the start point of the vertical line, you loose the first segment and thus, the two lines are no longer connected. This is not a flaw of this solution, but of the very concept of removing certain vertices. So consider very well what effects the operation will have and what you can use the output for (what what not).

enter image description here


You could try using the "Geometry by Expression" tool.

An expression like

make_line(start_point($geometry), end_point($geometry))

will ignore the middle vertex.

enter image description here

enter image description here

  • 1
    The problem is that I have more vertices in that line that I want to keep, so this solution could be useful if the line is short and has those only three vertices. Thank you!
    – Noe
    Apr 17, 2020 at 10:26

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.