3

I have two line segments that overlap nodes. I want to select them, and merge them into one complete segment, so that the overlapping nodes are combined to one node.

2 Answers 2

3

If the nodes of the two lines are snapped to each other, then select the two lines and use Merge Selected Features Tool which its icon is shown below

enter image description here

Then a prompt menu will appear to tell you which feature's attribute you are going to use. Please note that after merging the two lines, the vertex will not disappear, the vertex the connect the two lines will still exist because it depends on the angle between two lines. However, if you want to completely remove the vertex to completely turn it into a straight line, then you simply need to go to select Node Tool - as shown below - and click on the vertex that you want to delete until it turns to blue color, then press delete on your keyboard to delete the vertex completely after merging.

enter image description here

1
  • This is the best solution for a selection of lines. However, if you want to join the whole dataset at once, use the dissolve tool I listed in my answer.
    – jbalk
    Aug 23, 2016 at 3:13
2

There are a few options, here are two:

1 - Entire Dataset:

Using SAGA tools in QGIS, select >vector line tools>line dissolve.

Input the line and the attribute you want to dissolve.

2 - Selection of lines:

Go to the plugin manager.

Install plugin:

Join multiple lines

Permanently join multiple lines

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.

homepage: https://github.com/dgoedkoop/joinmultiplelines


Update

After testing the tools I listed above, it is clear that the merge tool is the best solution for this question. The join lines tool doesn't get rid of the node, and the dissolve tool doesn't merge the lines.

If you want to automate this workflow, and have some python knowledge, you can select nodes that overlap and merge them in a loop. Then you can merge the whole dataset at once instead of by individual selections. When I have time I will look at producing some code.

6
  • I've tried the join multiple lines plugin, but it does not seem to work. After it completes, I can still move the nodes from the original segments. Aug 23, 2016 at 2:01
  • Use ahmadhanb's solution. Or try the line dissolve method that I listed.
    – jbalk
    Aug 23, 2016 at 3:10
  • I end up with an extra node, but a still non-closed segment, when using the SAGA tool: imgur.com/2NjFqiG and the Join multiple lines won't close it either. Aug 23, 2016 at 13:38
  • The nodes in your picture are not overlapping. Am I missing something?
    – jbalk
    Aug 23, 2016 at 23:32
  • They were overlapped, I just pulled them apart to show they weren't merged. Aug 24, 2016 at 0:23

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.