I have a line that I drew where the ends are not connected. I now want to select the two end nodes and hit a button to have QGIS connect them with a line segment. How do I do this?

2 Answers 2


Activate Snapping (Settings --> Snapping options...). Select required snapping mode and set at least Snap to (To vertext for your case) and some Tolerance value.

Than just edit layer and draw new line segment connecting two nodes. Now when you move cursor close enough to node when drawing line, the line will snap to the node (showing you the pink cross). Distance of snap is depend on Tolerance value.

For more information about snapping see QGIS User Guide

note: You can't snap to nodes which are just being drawn. It works only for already drawn features.

Snapping options

enter image description here


In newer QGIS versions, you can automatically close a line using Geometry by Expression with this expression:

close_line ($geometry)

Expression (here with Geometry Generator for visalization): red=initial line; balck= line created by the expression: 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.