Calculates the compass direction of the steepest downslope for each cell in a raster surface and returns the result as a raster of aspect values.
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 number. |
box | Box | The area to analyze. Specify the value in '((minX,minY),(maxX,maxY))' format. |
type | BoxType | The coordinate system for the extent. Valid values: Raster (pixel coordinates) or World (world coordinates). |
storageOption | cstring | The storage option for the output raster object. For details, see ST_ClipToRast. |
How it works
ST_Aspect computes, for each cell, the direction of the steepest downslope to its neighbors. The result represents the compass bearing of that direction, measured clockwise from north.
Output range: 0 to 360 degrees
Flat cells: assigned a value of
-1(no downslope direction)
The value in each output cell represents the slope direction of that cell, not the slope magnitude.
Example
The following example calculates the aspect for the area covering pixel coordinates (0,0) to (5,5) at pyramid level 0, band 0, using pixel coordinates:
SELECT ST_Aspect(rast, 0, 0, '(0,0),(5,5)', 'Raster')
FROM t_surface
WHERE id = 1;