How to merge intersecting line segments

7357
8
Jump to solution
06-10-2021 07:03 AM
Mikis
by
New Contributor II

Hi All,

I am looking for a method to merge intersecting line segments over a large dataset. In figure 1, I used the method by first selecting individual line segments, followed by the tool merge (in the edit toolbar). This 'manual' approach is very time consuming and I guess a more automated approach would speed things up.

The first approach I was thinking about was using the dissolve tool. However, if I check 'Create multipart feature', all my segments are dissolved into one feature, see fig 2. And if I leave the 'Create multipart feature' unchecked, only the overlapping features are merged, but not the intersecting (tributary) lines. I also tried checking the 'Unsplit lines' box without success. Does anyone here have a recommendation?

 

Mikis_0-1623332785126.png

fig 1, manual approach by selecting the polygons, then use merge in the editor toolbar. 

Mikis_1-1623332856536.png

fig 2 dissolve with 'Create multipart feature' checked 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

Here is a workaround that has worked for me.

1. Using the polyline layer, create a buffer (I created a 2 meter buffer with other parameters as default).

2. Dissolve the Buffer layer (Keep both "Create Multipart Features" and "Unsplit lines" unchecked).

3. Add a new field "ID" (Datetype:LONG) to the dissolved buffer layer, and transfer the "ObjectID" values to it.

JayantaPoddar_0-1623345033220.png

4. Using Spatial Join, transfer the attributes of Dissolved Buffer polygons to the original Polyline Features.

JayantaPoddar_1-1623345208304.png

5. Now, Dissolve the Polyline Feature (Joined) based on the "ID" field (Check "Create Multipart Features").

JayantaPoddar_2-1623345488292.png

 



Think Location

View solution in original post

8 Replies
JoeBorgione
MVP Emeritus

You lost me at "first selecting the polygons"...

There may be a way to spatially select the lines that intersect, but you'd need to start with a 'seed' line so you don't end up with what you've already done.

That should just about do it....
0 Kudos
Mikis
by
New Contributor II

Hi Joe,

Thanks for pointing it out, I changed the text. 

Anyways, here is the 'seed' line which I want to merge to the intersecting lines (but then of course for all clusters eventually) :

Mikis_1-1623336566161.png

 

 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Here is what you can do.

1. Dissolve. This will create a single record consisting of all segments.

2. Then do a Multipart to singlepart. This will separate out all the disconnected segments.



Think Location
0 Kudos
Mikis
by
New Contributor II

Hei Jayanta, 

Thank you for your reply. I did try that. The problem is it disintegrates the multipart feature (covering all the line segments) into single part features (splitting the line segments along the intersection points). This is not the result I was looking for as I am trying to merge the intersecting lines. This is what I get when I select one segment after 1. Dissolve and 2.  Multipart to singlepart:

Mikis_0-1623339234950.png

 

 

0 Kudos
JoeBorgione
MVP Emeritus

I think this gif shows what you want to do, right?  It starts with a single selected segment and recursively spatially selects intersecting segments.  The recursive part can be automated; you'd need to add some sort of counter to tell you when you've selected all the intersecting segments.  To me, planting the 'seed' is the tough part.

SpatialSelection.gif

That should just about do it....
Mikis
by
New Contributor II

Hi Joe , thanks for thinking along! This seems like a reasonable way to go. The problem here would be how to get the initial segment selected of a cluster and how the selected segments would merge in an automated approach. My intention was not to go through every cluster of intersecting segments individually as I am dealing with a large dateset.   

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Here is a workaround that has worked for me.

1. Using the polyline layer, create a buffer (I created a 2 meter buffer with other parameters as default).

2. Dissolve the Buffer layer (Keep both "Create Multipart Features" and "Unsplit lines" unchecked).

3. Add a new field "ID" (Datetype:LONG) to the dissolved buffer layer, and transfer the "ObjectID" values to it.

JayantaPoddar_0-1623345033220.png

4. Using Spatial Join, transfer the attributes of Dissolved Buffer polygons to the original Polyline Features.

JayantaPoddar_1-1623345208304.png

5. Now, Dissolve the Polyline Feature (Joined) based on the "ID" field (Check "Create Multipart Features").

JayantaPoddar_2-1623345488292.png

 



Think Location
Mikis
by
New Contributor II

Thank you Jayanta, this was indeed what I was looking for. 

0 Kudos