# Dissolve a polyline feature class so that touching features dissolve into a single feature

I'm trying to dissolve a polyline feature class so that spatially intersecting features become a single feature. When I run the Dissolve tool, setting `Create multipart features` and `Unsplit lines` both to false, I get unexpected results. In the example below, two line features I'd hoped to dissolve into one became three line features:

Is there a way to dissolve a line feature class so that any touching features dissolve into one?

• Why set `Unsplit lines` to false? – yanes Dec 22 '15 at 22:09
• @yanes because I want my features to dissolve if the intersect, even if there are no vertices at the point of intersection – Emil Brundage Dec 22 '15 at 22:11
• I see, the standard dissolve function doesn't have a tolerance option, are you sure your lines touch? or may be you need to do a snapping procedure if not-touching lines are the problem – yanes Dec 22 '15 at 22:16
• you can also use `merge` but I am not sure if automating is possible with that option – yanes Dec 22 '15 at 22:17
• Try building a geometric network from the lines. The build "should" snap and insert vertices at intersections, including flattening the lines you describe. From there it should be easy to dissolve. Set unsplit lines = true and multipart = false – Ben S Nadler Dec 23 '15 at 4:37

All three or four way intersections or non-intersecting crossing lines that dissolve are by definition going to form multi-part lines, since single part lines by definition can only have two end vertices and only two segments maximum can meet at any connecting vertex.

The way to do this is as follows:

1. Buffer the lines a very, very small amount and create a single feature (multi-part polygon).
2. Explode the polygon buffer into its separate parts to form polygons that cover only the lines that touch within the very, very small buffer distance.
3. Calculate a long field in the polygons to be equal to the ObjectID of each exploded polygon.
4. Use the Spatial Join tool with the lines as the target and the polygons as the join features.
5. Dissolve the lines created by the spatial join output using the long field from the polygon that has the ObjectID of the polygon as the Dissolve field (Case field). Make sure the Create Multipart feature option is checked and the line ends option is unchecked.

You will end up with what you are looking. Every lines that touches another line at any crossing or intersection of any kind will have merged into a single polyline feature. These polyline features will nonetheless be a multi-part line feature anytime a line crossing or 3-way or greater intersection exists.

I think your problem is that you need to leave "Create Multipart Features" set to True. The line you're describing is a multi-part line. By setting "Create Multipart Features" to false, you're telling the GIS to split those lines into two features.

• Setting that to true creates a single feature from the entire feature class. – Emil Brundage Dec 22 '15 at 22:29
• is the entire feature class connected (like a network where there are no gaps)? – yanes Dec 22 '15 at 22:33
• No, the single feature is multipart. – Emil Brundage Dec 22 '15 at 22:34
• then did you check if seemingly touching lines may be are not touching? or that is not the case? – yanes Dec 22 '15 at 22:36
• Oh, now I see your problem. You'd likely have to write a script that, at the geometry level, detects whether two lines are touching, then union that geometry into one object and write it back to a new file. – CStarbird Dec 22 '15 at 22:36

I think you will get what you want if you set both Create multipart features and Unsplit lines to TRUE (on). That unsplits contiguous lines but does not create discontiguous multipart features.