Joining touching polylines

Discussion created by rob_storrar on Jul 2, 2012
Latest reply on Feb 28, 2019 by Kyle.gonterwitz_KSDOT

I have two shapefiles, both containing several thousand polylines. One is of lines which are not connected (in red) and the other is the lines which connect them, filling in gaps (in blue): [ATTACH=CONFIG]15669[/ATTACH]

I want to merge these into a single shapefile, where all lines which touch are joined into a single feature, i.e. all the lines in the picture would be one feature but there would be other features, not just one. I have tried merging them into one shapefile and then using the dissolve tool but this only seems to work for single lines which start and end at the same point (in this case it would create two lines instead of one). Some lines start at a vertex, rather than an endpoint, so I essentially want to merge anything that touches with all the lines it touches, if that makes sense...

Any help would be much appreciated (unfortunately I have no understanding of how to implement script.....).