For a comparison analysis of intersected polygon feature classes I am trying to export 253 layer files to a PNG image using the Model Builder.
Unfortunately the 'Iterate Files' tool in the Model Builder won't let me iterate through the the .lyr-files in the workspace.
I am trying to use the following arcpy tool in a script linked to the iterator:
arcpy.mapping.ExportToPNG
It gives me the following error, as a .lyr file is nothing more than a reference to symbology and a feature class.
Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a File.
Failed to execute (LayertoPNG).
Hopefully someone could help me out, as I couldn't make this script work either:
or:
Try creating an in-memory Layer file while iterating and working with that instead:
# list lyr files in workspace lyrs = arcpy.ListFiles("*.lyr") for l in lyrs: lyr = arcpy.mapping.Layer(arcpy.Describe(l).catalogPath) layers = arcpy.mapping.ListLayers(lyr) for layer in layers: # process layer