[GIS] Which is more efficient process in ModelBuilder – Merge/Dissolve or Union/Dissolve

arcgis-desktopmergemodelbuilderunion

I'm creating a model which combines four very large files and dissolves them. At the moment, my workflow uses the Merge tool and then the Dissolve tool. However, I was wondering if using the Union tool and then dissolving would be more or less efficient. I don't need to maintain attributes for my purposes. I just need to create a layer which contains the geometry. The feature classes may overlap each other, and they may also contain overlaps within themselves. As the end result is the same, does anyone know which process would be more time efficient?

Below are screenshots of my workflows:

Merge then Dissolve:

enter image description here

Union then Dissolve:

enter image description here

Best Answer

This is a very simplistic test, but I think it shows conclusively that Merge+Dissolve is about 3 times quicker than Union+Dissolve on this dataset, and I believe that as more complex data is thrown at it, the difference will only widen.

import arcpy,time

if arcpy.Exists("C:/temp/test.gdb"):
    arcpy.Delete_management("C:/temp/test.gdb")

arcpy.CreateFileGDB_management("C:/temp","test.gdb")
arcpy.CreateFishnet_management("C:/temp/test.gdb/fishnet1","10 10","10 20","1","1","50","50","#","LABELS","0 0 75 75","POLYLINE")
arcpy.Buffer_analysis("C:/temp/test.gdb/fishnet1_label","C:/temp/test.gdb/fishnet1circles","0.51 Unknown","FULL","ROUND","NONE","#")
arcpy.CreateFishnet_management("C:/temp/test.gdb/fishnet2","10.1 10.1","10.1 20","1","1","50","50","#","LABELS","0 0 75 75","POLYLINE")
arcpy.Buffer_analysis("C:/temp/test.gdb/fishnet2_label","C:/temp/test.gdb/fishnet2circles","0.51 Unknown","FULL","ROUND","NONE","#")

start = time.clock()
arcpy.Merge_management("C:/temp/test.gdb/fishnet1circles;C:/temp/test.gdb/fishnet2circles","C:/temp/test.gdb/fishnetMerge","#")
elapsed = (time.clock() - start)
print("Merge took " + str(elapsed) + " seconds")
arcpy.Dissolve_management("C:/temp/test.gdb/fishnetMerge","C:/temp/test.gdb/fishnetMergeDissolve","#","#","MULTI_PART","DISSOLVE_LINES")
elapsed = (time.clock() - start)
print("Merge and Dissolve took " + str(elapsed) + " seconds")

start = time.clock()
arcpy.Union_analysis("C:/temp/test.gdb/fishnet1circles #;C:/temp/test.gdb/fishnet2circles #","C:/temp/test.gdb/fishnetUnion","ONLY_FID","#","GAPS")
elapsed = (time.clock() - start)
print("Union took " + str(elapsed) + " seconds")
arcpy.Dissolve_management("C:/temp/test.gdb/fishnetUnion","C:/temp/test.gdb/fishnetUnionDissolve","#","#","MULTI_PART","DISSOLVE_LINES")
elapsed = (time.clock() - start)
print("Union and Dissolve took " + str(elapsed) + " seconds")

I ran the test from IDLE using ArcGIS for Desktop 10.1 SP1 and Python 2.7.2 on Windows 7 SP1 and the results were:

>>> 
Merge took 1.82999991257 seconds
Merge and Dissolve took 5.45186011302 seconds
Union took 7.6488681498 seconds
Union and Dissolve took 14.1194398165 seconds
>>>

As you suggested the Dissolve after Union was a bit quicker than the Dissolve after Merge but not enough to overcome the large gap between Merge and Union.

Related Question