I have mxd's that have information loaded from many different locations (some FCs from FGDB, shps, FCs in EGDB) and I want to check the coordinate reference system quickly for them. I have attempted the code below but get a error on line 16 for unsupoported operand type for +: 'layer' and 'str'.
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD
df = arcpy.mapping.ListDataFrames(mxd, '')[0] # Chooses the first dataframe
layerlist = arcpy.mapping.ListLayers
for layer in layerlist(mxd, '', df): # Loop through layers
sr = arcpy.Describe(layer).spatialReference
if sr.name == "Unknown":
print layer + " has an unknown spatial reference\n"
# Otherwise, print out the feature class name and
# spatial reference
else:
print layer + ": " + sr.name + "\n"
No comments:
Post a Comment