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

Syntax

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

Parameters

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

Description

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.

Examples

select st_aspect(rast, 0, 0, '(0,0), (5,5)', 'Raster') from t_surface where id=1;
                                                       st_aspect                                                        
------------------------------------------------------------------------------------------------------------------------
 {5.68600864908691,5.742765806909,5.08963804002705,5.2696845155022,5.67764064357462,5.91019758537953,5.37643514321137,5.
..48370356795928,5.18761908299415,5.02882043600982,4.83181790640303,4.33940125858463,5.56909460856743,5.92299216276176,.
.5.86712080145576,5.29376916418959,4.41982721398084,4.53158940708072,0.141897054604164,0.274167451119659,6.267561578559.
.11,5.742765806909,4.56734728205808,4.7215630349298,0.547562235939998,6.0814229628593,5.96909743805248,5.80535425218747.
.,4.74463586281994,4.71238898038469,0.141897054604164,6.13281387917245,6.05997388768217,5.98920538937637,4.789160871654.
.47,4.4855901323308}
(1 row)