Snap raster 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 then the upper-right corner is adjusted using the output cell size. As a result, when the output cell size is same as the snap raster cell size, the cells in the output raster are aligned with the cells of the snap raster.
Learn more about how Snap Raster works
- In general, the snap raster is applied to tools that output a raster. The extent is not snapped when the output is a feature class, or a table, or a file.
- Snap raster can be used with default output extent. You do not need to specify an extent explicitly in environment to use snap raster.
- It is recommended to use the same cell size for snap and output raster. However, it is possible to have the snap raster cell size different from the output raster cell size. In that case, only the left and bottom boundaries will align with snap raster cells and the upper-right corner of the output extent may not coincide with a cell corner of the snap raster.
- Specifying snap raster does not change the values in output extent control immediately, however, the extent is adjusted during execution.
- The keyword used at the command line or in scripts for this environment setting is: SnapRaster.
- Snap raster specified as part of extent at the command line or in scripts will continue to work in ArcGIS 9.3 but it is recommended to use the new separate snap raster setting.
- Since the extent could be snapped to a larger extent, the output raster may contain an additional row and/or column of NoData cells.
- The size (i.e. the number of rows or columns) in a snap raster is not important. The origin and the cell size are used to adjust the output extent.
- The extent of the snap raster does not need to be overlapped with the output extent. Therefore, a small raster, located outside of your analysis area could be used for snapping.
- The keyword used at the command line or in scripts for this environment setting is: SnapRaster.
- Learn more about specifying general settings
- Learn more about environment settings
- Learn more about environment levels and hierarchy
An overview of the command line window
SnapRaster <raster_dataset>
| Parameters |
Explanation |
Datatype |
| <raster_dataset> |
The raster dataset to be used as the snap raster. |
Raster Dataset |
Data types for geoprocessing tool parameters
Command line example
SnapRaster C:\data\mysnapraster
An overview of scripting in geoprocessing
SnapRaster raster_dataset
| Parameters |
Explanation |
Datatype |
| raster_dataset (Required) |
The raster dataset to be used as the snap raster. |
Raster Dataset |
Data types for geoprocessing tool parameters
Script example
import arcgisscripting
gp = arcgisscripting.create()
gp.workspace = "C:/workspace"
gp.extent = "C:/data/projectbnd"
gp.SnapRaster = "C:/data/mysnapraster"
try:
# Set local variables
InRaster = "C:/data/dem"
OutRaster = "C:/data/aspect"
# Check out ArcGIS Spatial Analyst extension license
gp.CheckOutExtension("Spatial")
# Process: Aspect
gp.Aspect_sa(InRaster, OutRaster)
except:
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()