import os, sys, string, arcpy # define list of species spLst = ['0070','1320'] try: mxd = arcpy.mapping.MapDocument(r"C:/Workspace/Species.mxd") # check for broken paths brknList = arcpy.mapping.ListBrokenDataSources(mxd) if len(brknList) >= 1: print "Broken Paths Exist..." + brknList else: for sp in spLst: print "No broken paths, proceeding" lyrName = "ew20km_in" + str(sp) + "_2040" lyrList = arcpy.mapping.ListLayers(mxd, lyrName) for lyr in lyrList: # define variables out_png1 = r"C:/Workspace/pixels_500/rfbird_" + str(sp) + "_2040.png" out_png2 = r"C:/Workspace/pixels_800/rfbird_" + str(sp) + "_2040.png" resolution1 = 45 resolution2 = 72 lyr.visible = True # make layer visible, all other species should start as invisible arcpy.RefreshTOC() arcpy.RefreshActiveView() # export current layout view to png file # ExportToPNG (map_document, out_png, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {background_color}, {transparent_color}, {interlaced}) arcpy.mapping.ExportToPNG(mxd, out_png1, "PAGE_LAYOUT", "", "", resolution1, "", "24-BIT_TRUE_COLOR", "", "", "") arcpy.mapping.ExportToPNG(mxd, out_png2, "PAGE_LAYOUT", "", "", resolution2, "", "24-BIT_TRUE_COLOR", "", "", "") lyr.visible = False except: arcpy.AddMessage(arcpy.GetMessages(2)) print arcpy.GetMessages (2) print "Exited with Errors.... Something is wrong"
Solved! Go to Solution.
Arcpy.mapping parameters can't be skipped with empty quotes. In Python, if you want to skip parameters, you must call out the parameter name and set it appropriately. Once you do that, all subsequent parameters must be set the same way.
Jeff