Available with Spatial Analyst license.
You can control the analysis performed by Spatial Analyst tools with the geoprocessing environments. Understanding what these environments are and how they apply to tools will help you get consistent and accurate results from geoprocessing operations. The following resources provide more information on using environments, particularly with their hierarchy and using them in ModelBuilder:
Some environments will be conditionally supported, depending on the input format, the output format, settings made in the parameters for a tool, and particular behaviors for that tool.
While most tools support a common set of environments based on the types of inputs and outputs, there are some tools that have exceptions. Review the environments list near the end of each tool reference page to see all the environments the tool can support. The usage notes may also contain any additional details on environment support for a tool.
The relevant environment groupings are as follows, with some specific environments related to raster analysis highlighted:
- Output Coordinates
- Processing Extent—Extent, Snap raster
- Feature Output
- Raster Analysis—Cell size, Cell size projection method, Mask
- Raster Storage—Compression, Pyramid, Raster statistics, Tile size
- Parallel Processing—Parallel processing factor
A geodatabase workspace is a container for geographic data. It is a collection of geographic datasets stored in a file system folder or database management system.
There are two workspace environments that you can use to control where inputs are found and outputs are created when using the Spatial Analyst extension.
The Current Workspace environment setting specifies the workspace for the current session.
It is the location from which inputs are obtained and outputs are placed when running Spatial Analyst tools.
The Scratch Workspace environment specifies where any temporary output datasets that the tool generates are placed.
When performing analysis, if the area of interest is a portion of a larger raster dataset, you can set the processing extent to encompass only the desired cells. All subsequent output rasters from analysis will be limited to this extent. For consistent results in your analysis, you can also control the cell alignment to match existing raster datasets.
The Extent environment is used to control where the raster processing occurs. Tools that honor the Extent environment will only process raster cells and input features that fall within the extent.
When you define an output extent, the lower left corner of the specified extent will be the lower left corner of the output raster, unless you have also specified a Snap Raster environment.
From there, the upper right corner of the output raster is adjusted in such a way that the specified extent falls within the output raster. Whether the upper right corner will be adjusted or not is determined by the output cell size. The width and the height of the output raster extent are multiples of the output cell size. The end result is that the extent of the actual output raster can be slightly larger than what is specified in the Extent environment.
If the lower left corner of the output extent does not match any cell corner of the input raster, it will create a shift in the cell alignment between the input and output rasters. This difference of cell alignment will trigger a resampling of the input raster to perform analysis. For most of the Spatial Analyst tools, the Nearest Neighbor resampling technique is used, apart from the Surface tools, which use Bilinear Interpolation.
For most Spatial Analyst tools, when an Output Extent environment is specified, it will be applied to the inputs before performing the analysis. However, for some other tools, such as the Interpolation tools, the output extent will be applied only to the output after the analysis has been performed.
The Snap Raster environment can be used to ensure that all your raster outputs have the same cell alignment or the same alignment as an existing raster.
The lower left corner of the extent is snapped to a cell corner of the snap raster, and the upper right corner is adjusted using the output cell size. As a result, when the output cell size is the same as the snap raster cell size, the cells in the output raster are aligned with the cells of the snap raster.
Certain Spatial Analyst tools can create feature data as output and, as a result, may support the following types of environments when the output is to a geodatabase:
- XY Resolution—XY Resolution and XY Tolerance
- M Values—M Resolution, M Tolerance, and Output has M Values
- Z Values—Default Output Z Value, Output has Z Values, Z Resolution, and Z Tolerance
See the appropriate sections for more details on those environment categories.
Certain geodatabase environments are supported.
One tool, Extract Multi Values to Points, supports the Qualified Field Names environment.
The raster analysis environments allow you to control the cell size and cell alignment of the output raster, as well as limit the analysis to specific locations within the analysis extent.
The Cell Size environment controls the resolution of the output raster from Spatial Analyst tools.
The default setting for this environment is Maximum of Inputs, which is the largest (coarsest) cell size of the input raster datasets. If the input to the tool is a feature class, the default cell size is the width or height (whichever is shortest) of the extent of the feature class divided by 250.
Exercise caution when specifying a cell size finer than that of the input raster datasets. No new data is created; cells are interpolated using nearest neighbor resampling, so the result can only be as precise as the coarsest input.
Cell Size Projection Method
The Cell Size Projection Method environment setting determines how the output raster cell size will be calculated when datasets are projected during analysis. The available methods are Convert Units, Preserve Resolution, and Center of Extent. The default method is Convert Units.
To learn more about Cell Size Projection Method, see How Cell Size Projection Method works.
The Mask environment is used to identify those cell locations that will be included when performing an analysis. All input cells that fall outside the mask are assigned the NoData value in the result. A mask can be a raster or a feature dataset.
For most Spatial Analyst tools, when a Mask environment is specified, it will be applied to the inputs before performing the analysis. However, for some other tools, such as the Interpolation tools, the mask will be applied only to the output after the analysis has been performed.
With the raster storage environments, you can control certain properties of output rasters. There are also some format dependencies, so review the help page of any particular tool you are using for more specific details.
The following are the three primary things that influence which raster storage environments are supported when a tool is executed:
- Raster format—Generally, there is a difference between which raster storage environments are supported when the output is an Esri grid versus the other supported raster formats, such as file geodatabase or TIFF rasters.
- Data type—Whether an output is integer or floating point can determine whether a particular raster storage environment is supported or not.
- Parameter settings—Certain tools have a parameter that can determine the type of the output raster.
For certain tools, the type of the output is determined by the types of all of the inputs. For example, if the tool takes several input rasters, and all of them are integer save for one that is floating point, the output raster would be floating point. When the output is floating point, fewer of the raster storage environments may be supported.
Each tool reference has an Environments section near the bottom of the page. All of the environments that can be supported by the tool will be listed here. Note that this list is inclusive of all outputs from a tool, including those that are optional. For example, consider the Cost Distance tool, whose primary output is a floating-point raster. While floating-point rasters do not support the Compression environment setting, there is an optional output backlink raster, which is integer. Since integer rasters for certain formats can support Compression, this environment will be present in the supported environments list. This is an important detail to understand when assessing these environments.
The following sections provide more detail on each of the raster storage environments.
The Compression environment setting is generally honored for output integer rasters. If the output is floating point, the setting is ignored and the output raster is always uncompressed.
Integer rasters in the Esri grid format always employ a run-length encoding (RLE) compression, so setting the environment to None will not have any effect on the output grid.
While some formats may otherwise allow for lossy compression, only the Compression Type parameter is supported. The Compression quality parameter is not supported, and essentially is 100, regardless of it being set to any other value.
The Pyramid environment setting is generally not honored, since pyramids are not created for raster output from the majority of tools in Spatial Analyst. There are a few exceptions to this for certain tools in the Segmentation and Classification toolset.
The Calculate Statistics parameter of the Raster Statistics environment setting is generally not honored for the majority of tools in Spatial Analyst. There are a few exceptions to this, such as certain tools in the Segmentation and Classification toolset.
The Tile Size environment setting is generally supported by Spatial Analyst tools for the following output formats: TIFF, file geodatabase, or an SDE geodatabase.
The default tile size is 128 x 128 cells.
Certain tools support parallel processing for improved performance. The following environment gives you some control over how those resources are allocated.
Parallel Processing Factor
Set the value for the Parallel Processing Factor.