hillshade: Hillshading

hillshade,GRaster-methodR Documentation

Hillshading

Description

Hillshade rasters are often used for display purposes because they make topographical relief look "real" to the eye.

Usage

## S4 method for signature 'GRaster'
hillshade(x, angle = 45, direction = 0, zscale = 1)

Arguments

x

A GRaster (typically representing elevation).

angle

Numeric: The altitude of the sun above the horizon in degrees. Valid values are in the range [0, 90], and the default value is 45 (half way from the horizon to overhead).

direction

The direction (azimuth) in which the sun is shining in degrees. Valid values are in the range 0 to 360. The default is 0, meaning the sun is at due south (180 degrees) and shining due north (0 degrees). Note that in this function, 0 corresponds to north and 180 to south, but in the GRASS module r.relief, "east orientation" is used (0 is east, 90 is north, etc.).

zscale

Numeric: Value by which to exaggerate terrain. The default is 1. Numbers greater than this will increase apparent relief, and less than this (even negative) will diminish it.

Value

A GRaster.

See Also

terra::shade()

Examples

if (grassStarted()) {

# Setup
library(terra)

# Example data
madElev <- fastData("madElev")

# Convert a SpatRaster to a GRaster
elev <- fast(madElev)

# Calculate all topographic metrics
topos <- terrain(elev, v = "*")
topos

plot(topos) # NB Aspect has values of NA when it cannot be defined

# Calculate a hillshade raster
hs <- hillshade(elev)
plot(hs)

}

adamlilith/fasterRaster documentation built on Oct. 26, 2024, 4:06 p.m.