While it is common knowledge that Spatial Analyst tools are designed to operate on square cells, rasters with rectangular cells are supported as input. Have you ever wondered what happens when rasters with non-square cells are used?
When an input raster has rectangular cells, the data will be processed by Spatial Analyst in such a way that the output will have square cells. It is important to understand how the cell size and extent are changed and how the values of the original cells are handled.
- Cell size:
By default, rectangular input cells will be processed as square cells based on the width (x-dimension) of the input cells. For example, if the input rectangular cells are 68m in width by 83m in height (as some older Landsat 3 MSS sensor data was), provided no other environment settings are made, the output raster would be in square cells with a 68m cell resolution.
- Output raster extent, row count and column count:
The extent of the output raster will be as close to the input as possible. However, unless the input cell width and extent are an even multiple of each other, the number of rows or columns will be adjusted up or down one output cell size to accommodate the difference.
For example, consider a 1000 x 1000 cell input raster with cells 68m in width and 83m in height. Assume for convenience a starting origin for the lower left of 0,0. The extent for this raster would be 68000 in the X and 83000 in the Y. In the process of becoming a raster with square pixels of the 68m width, the resampling process will convert this to a raster of 1000 cells in the horizontal and about 1220 cells in the vertical. The extent of the data is maintained as much as possible, but the final output may be one cell size smaller or larger, depending on what will be closest to the original extent. In this example, dividing the vertical extent of 83000 by 68m results in 1220.5882, and so will be rounded up to 1221 cells. In this case, the output values in the last available row will be duplicated.
The lower left origin will remain the same between the input and output raster.
When input raster cells have different cell sizes, cell alignments, or in this case, shapes, aprocess will occur in the analysis. For the majority of Spatial Analyst tools, the type of resampling that occurs is Nearest Neighbour. This is an important consideration if you are processing non-discrete data, such as continuous elevation values.
In the following graphic, you’ll note that in the output, the third and fourth rows from the top have essentially duplicate values. This is a result of the center of those cells being closest to the same cell in the input raster. When resampling with Nearest neighbour, having adjacent rows or columns with identical values is a common occurrence.
Read on for information on how you can have more control over the operation.
Controlling with the Environment
In order to better control how the rectangular input cells are handled in the processing, you can use the geoprocessing Environments.
- Cell Size
Use the Cell Size environment to control the cell size of the operation for the Spatial Analyst tool you are using. You can set it to a different value than the default (the width of the input rectangular raster cells), to a specific value you enter, or to another existing raster dataset.
- Snap Raster
The Snap Raster environment allows you to control the cell alignment of the output raster. Having rasters with the same cell size and cell alignment in your analysis helps you get more consistent results, and can reduce the amount of processing done on the cell values.
- Output Extent
The Output Extent environment essentially controls how much of the input will be processed by a tool. You can use this to constrain the operation to a portion of the input raster. You can also use feature data to define the extent.
When using the Extent environment, it is generally recommended to also use a Snap Raster. This will allow you to maintain greater consistency in the output rasters.
You cannot control the type of resampling that Spatial Analyst tools will use in their operation; for most of them it will always be Nearest neighbour. However, if you wish to control how the input values are resampled in the operation, first run the Resample tool on the input rectangular-cell raster. With this tool you can select other methods of resampling, such as Bilinear interpolation and Cubic convolution, as well as the desired cell size.
Spatial Analyst tools only support certain of the Raster Storage environment settings. The Resampling Method is not one of them, and so will not have any effect.