I have to export about 250 layers in one mxd File to maps in ArcGIS 10.
I found a script on this site at Exporting each layer in map to separate image using ArcPy?:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, '')[0] # assuming there is only 1 df you're interested in
#Read input parameters from script tool
allLayers = arcpy.GetParameterAsText(0) # Must be a multivalue in script tool params
lyrList = allLayers.split(";")
PNGPath = arcpy.GetParameterAsText(1)
#Turn of all lyrs in list
for lyr in arcpy.mapping.ListLayers(mxd, '', df):
for layer in lyrList:
if lyr.name == layer:
lyr.visible = False
arcpy.RefreshActiveView()
# Loop through each layer, turn it on and export map as PNG
for lyr in arcpy.mapping.ListLayers(mxd, '', df):
for layer in lyrList:
if lyr.name == layer:
lyr.visible = True
arcpy.RefreshActiveView() # May want to test without this -- ArcMap might export correctly without need for refresh active view
arcpy.mapping.ExportToPNG(mxd, PNGPath+"\\" + lyr.name + ".png")
lyr.visible = False
I never before handled Python.
I opened Geoprocessing -> Python in ArcGIS and copied the code wihtout changes. So far as I understand it nothing happened... Which part of the code do I have to change or add to make it run on my computer?