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


float8[] ST_Aspect(raster rast, integer pyramid_level, integer band, Box extent, BoxType type);


Parameter Description
rast The raster object.
pyramid_level The pyramid level.
Band The sequence number of the band.
box The area to be analyzed, in the format of '((minX,minY),(maxX,maxY))'.
type The coordinate type of the area to be analyzed. Valid values:
  • Raster: pixel coordinates
  • World: world coordinates


The aspect function identifies the downslope direction of the maximum rate of change in value from each cell to its neighbors. The aspect can be thought of as the slope direction. The value of each cell in the output raster indicates the compass direction that the surface faces at that location. The aspect is measured clockwise in degrees from 0 (due north) to 360 (again due north), which comes full circle. Cells that are flat, which have no downslope direction, are assigned an aspect of -1 in the output raster.

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


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