I have a line layer in which the lines have several gaps.

enter image description here

How can I quickly close the gaps in QGIS 3.4?

Is there a tool or plugin available I haven't found yet?

  • 3
    Actually, this is by far not as trivial as you may think. Using your example, imagine a third line with a valid end point (meaning there should be a gap, for reasons) somewhere near one of those two you have drawn; how would you make any algorithm decide which gap to close? Do you have any common identifier for lines that should get connected? E.g. a road name, based on which a set of vertices can be connected to a single line? Or are there any attribute sequences used to determine line order? Are all lines digitized in a consistent direction?
    – geozelot
    Mar 16 '20 at 11:09
  • As geozelot notes this is not trivial. I did it many years ago in MapBasic on a sewer network using buffers on line endpoints looking for other lines startpoint within the buffer and also checking attributes identifying a sewer line like material and dimension. Got like a 90% match and the sewer company was happy. Don't know the Join multiple lines plugin, but is seems like a manual process selecting first what to be joined.
    – Jakob
    Mar 16 '20 at 17:04

The Join multiple lines plugin seems to do this:

After selecting multiple features of a line layer, this plugin can merge them into one feature with a continuous line. The plugin will automatically put the selected lines in a geographically logical order and direction. If the end points of two lines do not match exactly, a line segment between both points is added to make the end result a single, continuous line. The attributes of the new line will be those of one of the selected features, but one cannot predict which one.

  • After desperate trying different way to close gaps between only about six parts of a bike trail this was my rescue! The answer should much more appreciated!
    – user16032
    Sep 23 '20 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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