Computes the aspect (downslope direction) of each cell on a raster surface and returns the result as a raster object.
Syntax
raster ST_Aspect(raster rast, integer pyramid_level, integer band, Box extent, BoxType type, cstring storageOption);Parameters
| Parameter | Type | Description |
|---|---|---|
rast | raster | The raster object. |
pyramid_level | integer | The pyramid level. |
band | integer | The band sequence number. |
extent | Box | The area to analyze, in '((minX,minY),(maxX,maxY))' format. |
type | BoxType | The coordinate type used to define the analysis area. Valid values: Raster (pixel coordinates) and World (world coordinates). |
storageOption | cstring | The storage option for the raster object. For details, see ST_ClipToRast. |
How it works
ST_Aspect identifies the downslope direction of the maximum rate of change from each cell to its neighboring cells. This direction is the slope direction.
Each output cell contains the compass bearing of the aspect, measured clockwise from north in degrees.
Usage notes
Aspect values are in degrees, ranging from 0 to 360, measured clockwise from north.
Cells with zero slope (flat areas) are assigned an aspect of -1.
Set
typetoRasterto use pixel coordinates, orWorldto use world coordinates.
Example
The following example computes the aspect of a 5x5 pixel area (from pixel (0,0) to pixel (5,5)) on band 0 at pyramid level 0, using pixel coordinates.
SELECT st_aspect(rast, 0, 0, '(0,0), (5,5)', 'Raster')
FROM t_surface
WHERE id = 1;