This function calculates the hillshade from each cell over the surface of a raster object and returns an array of hillshades.


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


Parameter Description
rast The raster object.
pyramid_level The pyramid level.
band The sequence number of the band.
extent 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.
azimuth The azimuth angle of the sun. The azimuth angle is measured clockwise from the north. Unit: degrees. Valid values: 0 to 360. Default value: 315 (northwest).
altitude The altitude angle of the sun above the horizon. Unit: degrees. Valid values: 0 to 90. A value of 90 indicates that the sun is directly overhead.
storageOption The storage option of the raster object. For more information, see ST_ClipToRast.


The ST_Hillshade function obtains the hypothetical illumination of the surface of a raster object by determining the illumination value from each cell of the raster object. This function assigns a position for a hypothetical light source and calculates the illumination value of each cell in relation to neighboring cells. This function can greatly enhance the visualization of a raster surface for analysis or graphical display, especially when transparency is used.

By default, shadow and light are displayed as shades in gray that are associated with integers from 0 to 255. The darkest shade is represented by 0, and the brightest shade is represented by 255.


select st_hillshade(rast, 0, 0, '(0,0), (5,5)', 'Raster', 4, 180, 80) from t_surface where id=1;