Using "Same as Display" Extent in ArcGIS Pro script?

08-02-2019 08:55 AM
Occasional Contributor III

The Extent geoprocessing environment setting documentation here:

lists "Same as Display" under the dialog syntax, but not under the scripting syntax.  I am building a script tool that requires "Same as Display" to be set as a default.

Could someone share a snippet of code that demonstrates how I would set arcpy.env.extent to get the same effect as setting "Same as Display" in the dialog window?

0 Kudos
2 Replies
Occasional Contributor

Hi Eric,

You should be able to use the following snippet provided the user is running the tool from within Pro and has the map view open.


aprx ="CURRENT")
mv = aprx.activeView
ext =
arcpy.env.extent = "{}, {}, {}, {}".format(ext.XMin, ext.YMin, ext.XMax, ext.YMax)

New Contributor III

Thanks, you rock! Cut down a process using feature services as inputs from 13 minutes to 32 seconds.

0 Kudos