Frequently asked question

What is the algorithm used in the ASPECT function in GRID or Spatial Analyst?

Last Published: April 25, 2020

Answer

Aspect identifies the compass direction of the maximum rate of change in value from each cell to its neighbors. Aspect can be thought of as the slope direction.

Consider a 3x3 moving window over a raster, with 'a' to 'i' representing cell values. This moving 3x3 window visits each cell in the input raster and an aspect value is calculated for the cell in the center of the window, using an algorithm that incorporates the values of the cell’s eight neighbors.

Note:
If any neighborhood cells are NoData, they are assigned the value of the center cell. An example of this is when the 3x3 window is on an edge of a raster.
[O-Image] Aspect1
Taking the illustration above, the rate of change in the x direction for cell ‘e’ is calculated with the following algorithm:

(dz/dx) = ((c + 2f + i) - (a + 2d + g)) / 8

For example:
(dz/dx) = ((85 + 170 + 84)) - (101 + 202 + 101)) / 8
(dz/dx) = -8.125

The rate of change in the y direction for cell ‘e’ is calculated with the following algorithm:

(dz/dy) = ((g + 2h + i) - (a + 2b + c)) / 8

For example:
(dz/dy) = ((101 + 182 + 84) - (101 + 184 + 85)) / 8
(dz/dy) = -0.375

Taking the rate of change in the x and y direction for cell ‘e’, aspect is calculated using:

aspect = 57.29578 * atan2 (dz/dy, -dz/dx)

For example:
aspect = 57.29578 * atan2 (-0.375, 8.125)
aspect = -2.64

The above aspect value is then converted to values ranging in the compass directions (0 - 360 degrees) according to the following rule:

if aspect < 0
cell = 90.0 - aspect

else if aspect > 90.0
cell = 360.0 - aspect + 90.0

else
cell = 90.0 – aspect

For example:
Aspect = -2.64
aspect < 0
Cell = 90.0 - aspect
Cell = 90 – (-2.64)
Cell = 90 + 2.64
Cell = 92.64
[O-Image] Aspect2
The aspect value of 92 for cell ‘e’ = East.
Reference
Burrough, P. A. and McDonell, R.A., 1998. Principles of Geographical Information Systems (Oxford University Press, New York), p. 190.

Article ID:000004833

Software:
  • ArcMap 8 x
  • ArcMap 9 x
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic