Learn R Programming

raster (version 1.8-12)

hillShade: Hill shading

Description

Compute hill shade from slope and aspect layers. Slope should be expressed as a tangent (fraction), and aspect layers should be in radians. Slope and aspect can be computed with slopeAspect. A hill shade layer is often used as a backdrop on top of which another, semi-transparant, layer is drawn.

Usage

hillShade(slope, aspect, declination, direction, filename='', ...)

Arguments

slope
RasterLayer object with slope values expressed as a fraction (tangent)
aspect
RasterLayer object with aspect values expressed as radians
declination
The height of the light source (sun) expressed in degrees
direction
The direction (azimuth) of the light source (sun) expressed in degrees
filename
Character. Optional filename
...
Standard additional arguments for writing RasterLayer files

References

Horn, B.K.P., 1981. Hill shading and the reflectance map. Proceedings of the IEEE 69(1):14-47

See Also

slopeAspect

Examples

Run this code
dem <- getData('alt', country='CHE')
slas <- slopeAspect(dem)
hill <- hillShade(slas[[1]], slas[[2]], 40, 270)
plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
plot(dem, col=rainbow(25, alpha=0.35), add=TRUE)

Run the code above in your browser using DataLab