Created
December 3, 2019 14:39
-
-
Save OterLabb/784ce3fe216190980cd945cf1bc9e10e to your computer and use it in GitHub Desktop.
Zoom to each feature in a feature class in arcmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
import time | |
mxd = arcpy.mapping.MapDocument('CURRENT') | |
df = arcpy.mapping.ListDataFrames(mxd, "Layers") [0] | |
lyr = arcpy.mapping.ListLayers(mxd, "Layers", df)[0] | |
lst_shapes = [row[0] for row in arcpy.da.SearchCursor('feature_class', ['SHAPE@'])] | |
for shape in lst_shapes: | |
df.extent = shape.extent | |
df.scale = 650 | |
arcpy.RefreshActiveView() | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment