Select to view content in your preferred language

Merge Contiguous Lines Using Attribute Field

397
4
Jump to solution
02-19-2026 09:26 AM
Labels (2)
TrinityShuler02
Emerging Contributor

Hello! 

I have a feature class of almost 2,000 road lines that are split at every intersection and every bridge. 

I need to merge the roads together by the name of the road and the proximity of each line. 

For example, in the photo below, I would like to merge each of the 3 frontage road areas circled in red into 3 groups. In each group, there are currently multiple segments of frontage road (blue is selected, pink is unselected). I do not want to merge the feeder roads into the frontage road segment. 

TrinityShuler02_1-1771520772371.png

 

Here is the attribute table with all the frontage road segments selected: 

TrinityShuler02_2-1771520915152.png


And here are the selected frontage road segments:

TrinityShuler02_3-1771520933779.png


I've been merging all the segments by hand using the Merge tool in the Edit features pane, however this is very time consuming. 

Is there a way to build a script that uses the MSAG_Name field to merge together contiguous line segments with the same MSAG_name? 

I was thinking of some sort of if, then statement, such as if MSAG_Name = MSAG_Name AND segments are within 10 ft of each other, then merge. But I am very unfamiliar with Python or other coding languages, so I do not know how to write that myself.

The Pairwise Dissolve tool does not totally solve my problem because then all the features with the same MSAG_Name dissolve into 1 feature, but I need to retain the contiguous segments. 

 

0 Kudos
1 Solution

Accepted Solutions
AyanPalit
Esri Regular Contributor

@TrinityShuler02 Try Dissolve gp tool using  MSAG_name as Dissolve Field. Pay special attention to the parameters:

  • Create multipart features: unchecked
  • Unsplit lines: checked

 Change the parameters to get your desired output.

REF: How Dissolve works

Ayan Palit | Principal Consultant Esri

View solution in original post

0 Kudos
4 Replies
AyanPalit
Esri Regular Contributor

@TrinityShuler02 Try Dissolve gp tool using  MSAG_name as Dissolve Field. Pay special attention to the parameters:

  • Create multipart features: unchecked
  • Unsplit lines: checked

 Change the parameters to get your desired output.

REF: How Dissolve works

Ayan Palit | Principal Consultant Esri
0 Kudos
TrinityShuler02
Emerging Contributor

This did not solve my issue, I need to be able to merge features together within a certain distance, not just features touching vertices. 

TrinityShuler02_0-1771523985600.png

The three blue lines are within about 10 ft from one another, I would want all four of those segments to be included with the pink line feature. 

0 Kudos
AyanPalit
Esri Regular Contributor

OK, you will likely end up with multi-part features if you don't fill in the gaps.

Try:

  • Create multipart features: checked
  • Unsplit lines: unchecked

Also try, adding a flag field for the Buffer10FT. Repeat the dissolve with: MSAG_name and Buffer10FT  as Dissolve Fields. 

Ayan Palit | Principal Consultant Esri
0 Kudos
AyanPalit
Esri Regular Contributor

@TrinityShuler02 Curious if you got this to work? Please post the solution for others in the community.

Ayan Palit | Principal Consultant Esri
0 Kudos