This function calculates the slope from each cell over the surface of a raster object and returns an array of slopes that are expressed in radians.


raster ST_Slope(raster rast, integer pyramid_level, integer band, Box extent, BoxType type, float8 zfactor, cstring storageOption);


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
zfactor The conversion factor that is used to adjust the unit of measurement for the elevation units when the elevation units are different from the horizontal coordinates of the input surface. Default value: 1.
storageOption The storage option of the raster object. For more information,see ST_ClipToRast.


The ST_Slope function calculates the maximum rate of change in a value from each cell to neighboring cells. The maximum change in elevation over the distance between a cell and eight neighboring cells identifies the steepest downhill descent from the cell.


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