Tools that honor the Extent environment will only process features or rasters that are within the extent specified in this setting.
The Extent environment defines the features or rasters that will be processed by a tool. It is useful when you are processing only a portion of a larger dataset. You can think of this setting as a rectangle used to select input features and rasters for processing. The rectangle is used only to select features, not to clip them. The extent of the output dataset will typically be larger than the Extent environment to account for features or cells that pass through the extent rectangle.
The extent entered is assumed to be in the coordinate system in which the input data is stored, even if the Output Coordinate System environment is set. If the tool takes multiple input datasets, the first dataset defines the coordinate system of the extent.
- Current Display Extent —The extent will be based on the active map or scene. This option is only available when there is an active map.
- Extent of a Layer —The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.
- Browse —The extent will be based on an existing dataset.
- Intersection of Inputs —The extent will be based on the minimum or intersecting extent of all inputs. If no inputs overlap, a null extent with all zeros will result.
- Union of Inputs —The extent will be based on the maximum or combined extent of all inputs.
- Reset Extent —The extent will be reset to the default value.
When you use the Current Display Extent, Extent of a Layer, or Browse option, the extent will be read and stored.
arcpy.env.extent = extent
When set, the extent environment property returns an Extent object in Python.
An Extent object can be used to define the extent.
The extent where all input features or rasters overlap (intersect one another). Note that it is possible that none of the features overlap and that a null extent (zero width and height) may result. In such cases, no features or cells will be processed.
The combined extent of all input data. All features or cells will be processed.
"XMin, YMin, XMax, YMax"
Space-delimited coordinates that define the extent in the coordinate system in which the input data is stored.
The path to a dataset. The extent of the dataset will be used.
# Set the extent environment using a keyword
arcpy.env.extent = "MAXOF"
# Set the extent environment using the Extent class
arcpy.env.extent = arcpy.Extent(-107.0, 38.0, -104.0, 40.0)
# Set the extent environment using a space-delimited string
arcpy.env.extent = "-107.0 38.0 -104.0 40.0"
# Set the extent environment using a feature class
arcpy.env.extent = "C:/data/StudyArea_perim.shp"
# Set the extent environment using a raster
arcpy.env.extent = "C:/data/StudyArea.tif"