What is the best way to find the repeated layers in Arcmap? I have .mxd files open on my ArcMap. I want to find out which layers are repeated.
You can do this using arcpy.mapping:
>>> mxd = arcpy.mapping.MapDocument("CURRENT") # map document
... layers = arcpy.mapping.ListLayers(mxd) # list layers
... layer_set = set() # create empty set
... for layer in layers: # loop through layers
... if layer.name in layer_set: # check if duplicate
... print layer.name # or do something else
... else: # if not duplicate
... layer_set.add(layer.name) # add to the set
You could test the layer.dataSource if you're interested in finding duplicate feature classes, rather than layer names.
Retrieving data ...