I have a polyline shapefile containing a number of lines, some of which overlap. By overlap, I mean that they follow exactly the same path for some of their route, but also have bits that are not shared. As it's difficult to explain in words, the following images should help:



In the example above, you can see how the two selected lines overlap, and I want to merge them into one line feature.

Is there a way to do this with a built-in ArcGIS tool? If not, is there an easy way to check for overlapping in Python? (and then an easy way to merge two lines in python?)

  • I also have an similar problem.......I have plenty of of lines to merge. IS there a proper solution to do it automatically – user4184 Sep 9 '11 at 23:08
  • Have you found the answer? I have met the same question, and I haven't found any method to merge all segment lines automatically now. Manual is a frustrating path. – Rui Gao May 15 '19 at 17:38
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – Vince May 15 '19 at 18:45

Dissolve Lines

update link (28th October 2014) http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000005n000000 Single Part & DISSOLVE_LINES enable in the geoprocessing tool.

  • Thanks - I'd never seen that. However, is it possible to do this without having any attributes that I can do the dissolve on? From reading the docs (for v10.0) it seems that UNSPLIT_LINES and SINGLE_PART won't work together, but the DISSOLVE_LINES option requires a field to dissolve on. – robintw Jan 24 '11 at 1:58
  • 2
    In answer to my own comment...yes it is - it seems to work fine. Thanks! – robintw Jan 24 '11 at 14:56
  • So you can tick your own answer. – Mapperz Jan 24 '11 at 15:12
  • This link no longer works – jotamon Oct 28 '14 at 20:51
  • @snowgage updated link – Mapperz Oct 29 '14 at 2:15

If you use an ArcEditor license you could start ArcCatalog and:

  1. make a personal Geodatabase.
  2. create a Feature Dataset in the Geodatabase.
  3. Import your Shapefile in the Feature Dataset.
  4. Create a Topology in the Feature Dataset.
  5. Set the Topology Rule "Must not overlap" for your Layer.
  6. Run the Topology Validation.
  7. Check the results in ArcMap - you need to add the Topology Error Layer.

This will markup all the overlapping lines.

Hope this helps you :-)

  • Thanks - that's very useful. However, I can't seem to see a way to force all the bits found as errors to be merged - that is, to merge the overlapping bits of the polylines. Do you have any idea how to do that? – robintw Jan 21 '11 at 12:51
  • Maybe you can use the errors to select the overlapping bits (select by location) and then export them to a seperat layer. Then you delete the overlapping bits in your (copy of) original layer. Then you make a Spatial Join from your overlapping layer to your original layer - hereby you get the attributes from your overlapping bits added to the other lines. Then you load the overlapping bits layer to your spatial joined layer. Now you can use the Dissolve tool in ArcToolbox to merge features with the same ID. I have not tried it, but I think it might work, if you understand my long explenation. – Steen Kjeldsen Jan 21 '11 at 13:36

To fix, turn on the Topology toolbar, start editing mode, and use the Error Inspector and Fix Topology Error Tool. There are other tools to help you on the toolbar as well.


In an editing session, you could select the line segments you want to merge, then select Merge from the Editor drop down menu. The dialog box that will pop up asks you which segment you want to merge the others into. Either select the segment you want, or if it doesn't matter just go with the default.


This function will remove overlapping lines and replace (not merge) each segment with one of the features:

def remove_overlapping(input_polyline, output_polyline, tolerance=0):
    """Identifies overlapping (portions of) of a polyline feature class and replaces with one feature."""

    overlapping_segments = ScratchPath + "\\Scratch.gdb\\overlapping_segments"
    # Tolerance defines "overlap."
    tolerance_expression = str(tolerance) + " Feet"
    # Cutout overlap portions.
    arcpy.Intersect_analysis(in_features=input_polyline, out_feature_class=overlapping_segments, join_attributes="ALL",cluster_tolerance=tolerance_expression,output_type="LINE")
    # Discard all but one feature.
    arcpy.DeleteIdentical_management(overlapping_segments, fields="Shape",xy_tolerance=tolerance_expression,z_tolerance="0")
    multipart_after_erase = ScratchPath + "\\Scratch.gdb\\multipart_after_erase"
    arcpy.Erase_analysis(input_polyline, overlapping_segments,multipart_after_erase, cluster_tolerance=tolerance_expression)
    # Break apart multipart features which might have been created when using erase.
    arcpy.MultipartToSinglepart_management(multipart_after_erase, output_polyline)
    # Put the remaining feature (after DeleteIdentical) back into the rest of the feature class.
    arcpy.Append_management(inputs=overlapping_segments, target=output_polyline, schema_type="NO_TEST", field_mapping="#")
  • 1
    are you able to provide some comments within the code? – TsvGis Sep 30 '15 at 8:20
  • I added a few comments in the code. – Lowry Oct 1 '15 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.