Skip to content

Instantly share code, notes, and snippets.

@andybell
Last active October 30, 2019 15:23
Show Gist options
  • Save andybell/ed2e884dbd867412d3aa5336a5804127 to your computer and use it in GitHub Desktop.
Save andybell/ed2e884dbd867412d3aa5336a5804127 to your computer and use it in GitHub Desktop.
ArcGIS Pro map stop export
# loop through map stops and export an inset map
# run in an arcgis pro session
aprx = arcpy.mp.ArcGISProject("CURRENT")
# get the info for the map and layer
map = aprx.listMaps()[0]
mapstops = map.listLayers()[0]
# name of the layout
lyt = aprx.listLayouts("Layout")[0]
# number of stops
for i in range(0,24+1):
print(i)
mapstops.definitionQuery = f"Stop = {i}" # set the definition query
if i == 0:
lyt.exportToPNG(f"overview.png", resolution=300) # export to png
else:
lyt.exportToPNG(f"inset_stop_{i}.png", resolution=72) # export to png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment