This function calculates the aspect from each cell on the surface of a raster object and returns an array of aspects.

Syntax

raster ST_Aspect(raster rast, integer pyramid_level, integer band, Box extent, BoxType type, cstring storageOption);

Parameters

Parameter Description
rast The raster object.
pyramid_level The pyramid level.
Band The sequence number of the band.
box The area that you want to analyze. Specify the value in the '((minX,minY),(maxX,maxY))' format.
type The type of coordinate that is used to identify the area to be analyzed. You can specify only one value. Valid values:
  • Raster: pixel coordinates
  • World: world coordinates
storageOption The storage option of the raster object. For more information, see ST_ClipToRast.

Description

The ST_Aspect function is used to calculate the aspect from the surface of a raster object. The aspect identifies the downslope direction of the maximum rate of change in a value from each cell to neighboring cells. The aspect can be considered the slope direction. The value of each cell in the output raster object indicates the compass direction of the aspect. The aspect is measured clockwise from the north. Unit: degrees. Valid values: 0 to 360. Cells in the input raster object that are flat and do not have a downslope direction are assigned an aspect of -1 in the output raster object.

The value of a cell in the aspect dataset of the output raster object indicates the slope direction of the cell.

Example:

select st_aspect(rast, 0, 0, '(0,0), (5,5)', 'Raster') from t_surface where id=1;