Skip to content

Instantly share code, notes, and snippets.

@alexfriant
Last active November 13, 2020 19:40
Show Gist options
  • Save alexfriant/d7327ba7693e5c5f5cba7079622b59cf to your computer and use it in GitHub Desktop.
Save alexfriant/d7327ba7693e5c5f5cba7079622b59cf to your computer and use it in GitHub Desktop.
list the minimum scale values for all layers in an mxd (the don't show out-beyond scale)
#################################################################################
#
# Requirements: You'll need ArcGIS Desktop 10.1 or higher with Python 2.7
#
# If you are publishing an MXD as a map service you might get a warning from
# the Analyze option that some number of layers "draws at all scale ranges".
#
# This script lists all the layers in the MXD you have open and what their
# minimum scale is set at, if at all. Those with '0.0' values have no value set.
#
# Instructions: This is code you can copy/paste into the ArcMap Python
# interactive console with the MXD open that you wish to review.
#
# You can copy/paste it all at once, or you can paste a little bit at a time to
# modify what ever needs changing.
#
# Feel free to use, rewrite, and distribute as you wish.
# As always, use at your own risk!
#
#################################################################################
# set your mxd and get list of layers
mxd = arcpy.mapping.MapDocument("CURRENT")
lyrs = arcpy.mapping.ListLayers(mxd)
# output a list of layer: scale pairs to the console
for lyr in lyrs:
print lyr.name + ": " + str(lyr.minScale)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment