I have lots of different lines composed of hundreds of segments in a Shapefile.

I would like to join them spatially where every start (or end) point of a segment correspond exactly (or within a range of X mm, but this extra) to the start (or end) point of an other segment. And only there. In other word everywhere a segment touch an other at his beginning or ending, they should be joined. (Attributes are always the same except for one column with specifics IDs I don't care about.)

The dissolve tool doesn't work; it compose a unique feature containing absolutely all lines, even those which are far away. All the segments are entire features, so the "multi to single part" vector tool doesn't work either. I have also tried the "Join Lines" and "Join multiples lines" plugins; they both don't do the job. Except the "Join Lines"; it is doing it correctly, but I have to select manually two segments then click to join them. It's not possible to do so manually of hundreds of them.

It would be nice if this can be done on a selection as there is several types (rivers, roads, paths, etc) of lines in this Shapefile.

  • 1
    Have you tried MergeLines? – ArMoraer Jul 21 '16 at 17:38
  • It's said it's a simplification tool. I do not need a simplification tool, the geometry must be the same in the ouput. And there is no notion of network on my data.<br/> Anyway, as I do not have other solutions yet, I gave it a try; it was really really long (~20min) to process data (6.7Mo single geojson file, or ~4Mo shape files). And there is no option to do so on lines of the same type, e.g. on a specific attribute, or on a selection. Finally, at the end of the computation, the window stay here with the 100% bar full and the shape created has some lines merged, others not, it seems random. – s.k Jul 21 '16 at 22:02
  • This can be accomplished easily in R, follow accepted answer in this post stackoverflow.com/questions/9751619/… – Kartograaf Oct 13 at 18:07

Your Answer

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

Browse other questions tagged or ask your own question.