import arcpy mxd=arcpy.mapping.MapDocument("C:\\Path\\To\\Your\\Map.mxd") #path to your MXD targetLayers=["Alberta","Ontario","Nova Scotia"] #Layer names as they appear in TOC df=arcpy.mapping.ListDataFrames(mxd)[0] #if you are not using the first dataframe in the MXD, change '0' to the 0-based index of whichever dataframe use wish to use allLayers=arcpy.mapping.ListLayers(df) for targetLayer in targetLayers: for lyr in allLayers: if targetLayer==lyr.name: #Zoom to layer: ext=lyr.getExtent() df.extent=ext #Export TIF: arcpy.mapping.ExportToTIFF(mxd, "C:\\Path\\To\\TIFs\\"+targetLayer+".tif") #path to desired location and filename of TIF file del mxd del allLayers del lyr #this line will error if you supply an empty MXD print "Completed Successfully!"
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.