I have a vector layer, in which structures (pipes under roads) are made up of multiple lines. I wish to spatially join all the lines that make up a single structure, but cannot figure out a way to do this. I've been messing around with things like "dissolve", but that merges all lines in the layer into a single feature. In the example below, I would like to join all of the orange lines that touch, resulting in 3 features.



1 Answer 1


Have you tried simply dissolving your data into your single feature dataset, then perfoming a multi-part to single part? Such that each geometry would then be its own new record?

At a much grander scale, I think the approach you should take is to solve the problem on the creation of the dataset - rather than fixing this already erroneous dataset. There are too many variables (eg: Does the endpoint of line 1 snap to a segment on line 2? - If it doesn't your data is crap and you will end up with lines going everywhere).

Im not sure if you have access to the raw data or the process that was used to create the lines, so this might not even be possible at all.

But assuming you have the raw pipework dataset, you could a few new approaches. Approach 1 - Store the 'under road' attribute as master data against the original pipe data. It is not uncommon to store attributes about a linear infrastructures 'situation' (eg: Above ground/below ground - or perhaps whether its inside of conduit etc) This would require generating polygons of the road reserves, splitting the pipe records where they intersect with those road reserves. Then assigning the attribute to the records that are within the road reserve polygon. (Ideally, then create a capture business rule for the pipework data, such that it tests for this condition).

Approach 2 - Dynamically recalculate the pipe sections that are beneath a road. This would use almost the same technical logic as approach 1, but instead of storing it as an attribute, a new layer/view is created dynamically, possibly by a geoprocessing engine of some description. 'Show the pipe sections (or portions of pipe sections) that overlap road reserve polygons.

Both the above solutions assumes:

  • you have access to the original raw pipe data.
  • access to the road reserve polygons.
  • 1
    Was able to use your approach(the first lines) to merge the touching lines. Simple and straightforward.
    – mapperx
    Oct 21, 2021 at 11:32

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.