The Snap Raster environment is used to snap or align an extent during execution. 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.
The extent to be snapped depends on the following:
- Input datasets
- Extent environment setting
- If the tool has an Extent parameter
With the default option for the Extent environment setting, for a single input dataset, the extent is the same as that dataset. For multiple inputs, the extent is the intersection of those inputs. Note that some tools have a particular behavior with respect to how the extent is handled; see the help for the particular tool for more information.
Any non-default setting for the output extent (in other words, Union of Inputs, Current Display Extent, or As Specified Below) overrides the default input dataset extent. The parameter extent specified as a parameter input to a tool overrides the environment output extent.
The output extent after snapping can be the same as the pre-snapped extent, or it can be larger (but never smaller). This ensures that cells or features along the boundary are included during execution when the output extent is set to the input dataset.
How Snap Raster works
The purpose of the snap raster is to adjust the extent so that the cells in the output raster align with the cells in the snap raster.
For a given snap raster and an extent (extent to be snapped), as shown in figure (a) below, the output extent is determined by adjusting the lower left and upper right corners.
The lower left corner of the given extent is moved to the nearest snap raster cell corner in such a way that the new lower left corner is outside of the given extent. If the lower left corner of the given extent already coincides with a cell corner of the snap raster, no adjustment will be made. The upper right corner of the given extent is moved to the nearest output raster cell corner in such a way that the new upper right corner is outside the given extent.
The cell alignment of the output raster can be visualized by considering the adjusted lower left corner as the origin and drawing lines at an interval of the output cell size parallel to the horizontal and vertical axes. If the cell size of the output raster is the same as the snap raster, the upper right corner will end up coinciding with a cell corner of the snap raster as shown below in figure (b).
On the other hand, if the cell size of the output raster is smaller than the cell size of the snap raster, the upper right corner may not coincide with a cell corner of the snap raster, as shown in figure (c). If the upper left corner of the given extent already coincides with a cell corner of the output raster, no adjustment will be made.
Snapping usually results in a larger output extent than the given extent. The output raster may end up with an additional row or column, or both, as shown in figure (b). The cell value in the output raster depends on where the cell center falls on the input raster. In this example, the left column and the top row in the output raster ended up being NoData because the cell centers of these cells fall outside the input raster.