I am processing a polyline file that contains multiple lines representing city roads. I would like to join the lines together into as few lines as possible. I've tried using the 'join multiple lines' plugin, but that creates additional lines that I do not want. Is there a way to only join all the lines that have the exact same endpoint/startpoint?

For context, I'm printing the vector file to a laser engraver. Unfortunately the laser engraver draws the lines in a (seemingly) random order, resulting in a very long print time (hours). I am trying to join the lines together to force the printer to draw connected lines in a logical order. I've tried the 'merge' command, but this hasn't worked because it doesn't change the order of the actual nodes.

I am using QGIS but am open to using other open source software to solve this problem.

Original roads in individual segments Figure 1: Original roads in individual segments

roads after using 'Join Multiple Lines' plugin Figure 2: Roads after using 'Join Multiple Lines' plugin

1 Answer 1


The Join Multiple Lines plugin should be able to do what you need:


You can install it in QGIS via Plugins --> Manage and Install Plugins


To avoid the added extra lines that Join Multiple Lines produces you can simply Clip (Vector > Geoprocessing > Clip...) the output of Join Multiple Lines with the original line layer. This should remove all of the additional lines, but retain the "single feature" quality of the Join Multiple Lines output.

  • the 'Join Multiple Lines' adds extra lines when two endpoints don't connect. It is very time consuming to delete these extra lines when dealing with a large road network.
    – Bomhof
    Jul 25, 2016 at 10:00
  • I've edited my answer to include a suggestions of how to deal with the extra lines -- let me know if it suffices for what you're after!
    – jbukoski
    Jul 25, 2016 at 14:12
  • Yes, the clipping worked. I didn't know you could clip a polyline with another polyline like that. thanks
    – Bomhof
    Jul 25, 2016 at 21:26
  • 1
    I didn't either... but figured I'd give it a try. We both learned something today!
    – jbukoski
    Jul 25, 2016 at 21:45

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.