My goal is to provide Users the ability to draw a rectangle on a map to pass the extents back to export a .png of the extent drawn.
This would be done through a
I see potential in the Clip and Ship functionality where the User Draws a Rectangle to pass the top and bottom x,y values.
My script currently uses a County Layer to select 1 or 2 counties.
The code then zooms to selected features extent.
This is sort of hit an miss as the user needs to know what counties to select.
I want the user to draw extent instead.
In that case, the If statement would go away.
map_extent = parameters.valueAsText
map_extent2 = parameters.valueAsText
outfolder = arcpy.env.scratchWorkspacemxd = r"\\Maps\MyMap.mxd"outputPath = outfolder + os.sep + "Map.png"if map_extent <> "Default Extent":
expression = '"altName" IN' + " ('" + map_extent + "', '" + map_extent2 + "')"
county_layer = arcpy.mapping.ListLayers(mxd)
arcpy.SelectLayerByAttribute_management(county_layer, "NEW_SELECTION", expression)
df = arcpy.mapping.ListDataFrames(mxd)
arcpy.mapping.ExportToPNG(mxd, outputPath)arcpy.SetParameterAsText(2, outputPath)