horizonHeight,GRaster-method | R Documentation |
horizonHeight()
uses a raster representing elevation to calculate the height of the horizon in a particular direction from each cell on a raster. Height is expressed in radians or degrees from the horizontal.
## S4 method for signature 'GRaster'
horizonHeight(
x,
units = "radians",
step = 90,
northIs0 = TRUE,
bufferZone = 0,
distance = 1,
maxDist = NULL
)
x |
A |
units |
Character: Units of the height. Either |
step |
Numeric integer between 0 and 360, inclusive: Angle step size (in degrees) for calculating horizon height. The direction in which horizon height is calculated is incremented from 0 to 360, with the last value excluded. |
northIs0 |
Logical: If |
bufferZone |
Numeric >= 0 (default is 0): A buffer of the specified width will be generated around the raster before calculation of horizon angle. If the coordinate system is in longitude/latitude (e.g., WGS84 or NAD83), then this is specified in degrees. Otherwise units are map units (usually meters). |
distance |
Numeric between 0.5 and 1.5, inclusive (default is 1): This determines the step size when searching for the horizon from a given point. The default value of 1 goes cell-by-cell (i.e., search distance step size is one cell width). |
maxDist |
Either |
A GRaster
with one or more layers. The layers will be named height_
xyz, where xyz is degrees from north or from east, depending on whether north or east orientation is used.
GRASS manual page for module r.horizon
(see grassHelp("r.horizon")
)
if (grassStarted()) {
# Setup
library(terra)
# Example data
madElev <- fastData("madElev")
# convert a SpatRaster to a GRaster
elev <- fast(madElev)
# calculate horizon height in north and east directions
hhNorth <- horizonHeight(elev)
hhNorth
plot(hhNorth)
# calculate horizon height in east and north directions
hhEast <- horizonHeight(elev, northIs0 = FALSE)
hhEast
plot(hhEast)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.