This function computes the hillshade from a raster surface and returns an array of hillshades.


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


Parameter Description
rast The raster object.
pyramid_level The pyramid level.
band The sequence number of the band.
extent 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
zfactor The conversion factor that adjusts the units of measure for the vertical (or elevation) units when they are different from the horizontal coordinate (x,y) units of the input surface. Default value: 1.
azimuth The azimuth angle of the sun, 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.


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

By default, shadow and light are shades of gray associated with integers from 0 to 255, which indicate from black to white.


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