Skip to contents

This tool performs a hillshade operation (also called shaded relief) on an input digital elevation model (DEM).

Usage

wbw_hillshade(dem, azimuth = 315, altitude = 30, z_factor = 1)

Arguments

dem

Raster object of class WhiteboxRaster. See wbw_read_raster() for more details.

azimuth

double, illumination source azimuth or sun direction (0 to 360 degrees)

altitude

double, the altitude of the illumination sources. i.e. the elevation of the sun above the horizon, measured as an angle from 0 to 90 degrees

z_factor

double, Z conversion factor is only important when the vertical and horizontal units are not the same in the DEM. When this is the case, the algorithm will multiply each elevation in the DEM by the Z conversion factor

Value

WhiteboxRaster object

Details

The hillshade value (HS) of a DEM grid cell is calculate as: $$HS = \frac{\tan(s)}{\sqrt{1 - \tan(s)^2}} \times [\frac{\sin(Alt)}{\tan(s)} - \cos(Alt) \times \sin(Az - a)]$$ where \(s\) and \(a\) are the local slope gradient and aspect (orientation) respectively and \(Alt\) and \(Az\) are the illumination source altitude and azimuth respectively. Slope and aspect are calculated using Horn's (1981) 3rd-order finate difference method.

If the DEM is in the geographic coordinate system (latitude and longitude), the following equation is used: $$zfactor = \frac{1.0}{111320.0 \times \cos(midlat)}$$

where \(midlat\) is the latitude of the centre of the raster, in radians.

References

For more information, see https://www.whiteboxgeo.com/manual/wbw-user-manual/book/tool_help.html#hillshade

Gallant, J. C., and J. P. Wilson, 2000, Primary topographic attributes, in Terrain Analysis: Principles and Applications, edited by J. P. Wilson and J. C. Gallant pp. 51-86, John Wiley, Hoboken, N.J.

Examples

f <- system.file("extdata/dem.tif", package = "wbw")
wbw_read_raster(f) |>
  wbw_hillshade()
#> +-----------------------------------------------+ 
#> | WhiteboxRaster                                |
#> | dem.tif(Hillshade)                            |
#> |...............................................| 
#> | bands       : 1                               |
#> | dimensions  : 726, 800  (nrow, ncol)          |
#> | resolution  : 5.002392, 5.000243  (x, y)      |
#> | EPSG        : 2193  (Linear_Meter)            |
#> | extent      : 1925449 1929446 5582091 5585717 |
#> | min value   : 0.000000                        |
#> | max value   : 32713.000000                    |
#> +-----------------------------------------------+