make_shade function

Compute Hill Shade

Compute Hill Shade

Compute hill shade from a digital elevation model. A hill shade layer is often used as a backdrop on top of which another, semi-transparent, layer is drawn.

make_shade( x, scale = 2, neighbors = 8, angle = 40, direction = 270, normalize = TRUE )

Arguments

  • x: 'SpatRaster' object. Spatial raster of land-surface elevations, such as the dem dataset.
  • scale: 'numeric' number. Scaling factor used to convert the elevation values. The default value is 2.
  • neighbors: 'numeric' count. Number of neighboring cells to use to compute slope or aspect with. Either 8 (queen case) or 4 (rook case).
  • angle: 'numeric' number. The sun's angle of elevation above the horizon, ranges from 0 to 90 degrees. A value of 0 degrees indicates that the sun is on the horizon. A value of 90 degrees indicates that the sun is directly overhead. Default is a 40 degree angle.
  • direction: 'numeric' number. Direction (azimuth) angle of the light source (sun), in degrees. An direction of 0 degrees indicates north, east is 90 degrees, south is 180 degrees, and west is 270 degrees (default).
  • normalize: 'logical' flag. Whether to set values below zero to zero and results normalized between 0 and 1.

Returns

Spatial raster of hill shade values.

Examples

elevation <- terra::unwrap(dem) hillshade <- make_shade(elevation) terra::plot(hillshade, col = inlcolor::get_colors( n = 256, scheme = "grayC" ), mar = c(2, 2, 1, 4), legend = FALSE ) terra::plot(elevation, col = inlcolor::get_colors( n = 256, scheme = "dem2", alpha = 0.7, bias = 0.9 ), add = TRUE )

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center