The analysis environment of Spatial Analyst
Before beginning to perform analysis, it is important to understand the geoprocessing analysis environment within which you are working. The analysis environment includes the workspace into which results will be placed and the extent, cell size, and coordinate system of results.
When running geoprocessing tools, you can specify environment settings via the Environment Settings. You can override the default settings of the environments at various levels. Each tool dialog box has an Environments button that allows application-level settings to be overridden.
The four environment levels form a hierarchy where the application level is highest. In this hierarchy, environment settings are passed down to the next level, as illustrated below. At each level, you can override the passed-down environment settings with another setting.
The one exception to this hierarchy is with models. If you run the model from the ModelBuilder window, the application environment is passed down. If you run the model using its tool dialog box, the tool environment is passed down.
The workspace
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 ArcGIS Spatial Analyst.
Current workspace
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.
Scratch workspace
The Scratch workspace environment specifies where any temporary output datasets that the tool generates are placed.
The processing extent
When performing analysis, if the area of interest is a portion of a larger raster dataset, the processing extent can be set to encompass only the desired cells. All subsequent output rasters from analysis will be limited to this extent.
Output extent
The Output extent environment is used to control where the raster processing occurs in Spatial Analyst tools.
The extent is a rectangle, specified by identifying the coordinates of the window in map space.
Snap raster
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.
Raster analysis
The raster analysis environments allow you to control the cell size and cell alignment of the output raster, as well as limiting the analysis to specific locations within the analysis extent.
Cell size
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.
Mask
The Mask environment is used to identify those locations that will be included when performing an operation.
The mask can be a raster or a feature class. All input cells that fall outside the mask are not considered in the analysis and are assigned the NoData value in the result.
Setting the analysis mask is essentially a two-step process.
- Create the mask dataset if you do not already have one. It can be raster or feature (point, line, or polygon) data.
- To create a raster mask, one method would be to use the Reclassify tool, assigning NoData to those cells you want to exclude.
- To create a feature mask, create an empty feature class in ArcCatalog, then define the area of interest (the mask) using the ArcMap Editor toolbar.
- Once the dataset has been created, set its mask environment before executing the tool.
The mask environment is only available for Spatial Analyst tools.
Raster Storage
With the raster storage environments you can control certain properties of output rasters.
Compression
The environment setting for Compression is honored for output integer rasters from Spatial Analyst tools. If the output is floating point, the setting is ignored and the output raster is uncompressed by default.
Pyramids
The Pyramid environment setting is not honored for output rasters. Pyramids are not created for raster output from any Spatial Analyst tools.