streams,GRaster-method | R Documentation |
This function estimates the course of streams and rivers from an elevation raster. It is based on the GRASS module r.stream.extract
, where more details can be found (see grassHelp("r.stream.extract")
)
## S4 method for signature 'GRaster'
streams(
x,
accumulation = NULL,
depression = NULL,
flowThreshold = 1,
dirThreshold = 1,
montgomery = 0,
minLength = 1
)
x |
A |
accumulation |
Either |
depression |
Either |
flowThreshold |
Numeric > 0: Minimum threshold for a stream to be generated. The default is 1, which is not necessarily a reasonable value. |
dirThreshold |
Numeric (default is |
montgomery |
Numeric: The "Montgomery" exponent for slope, multiplied by accumulation as per |
minLength |
Numeric: First-order streams less than this length are removed (units in cells). Default is 0 (no removal). |
A GRaster
.
flow()
, flowPath()
, GRASS manual for module r.stream.extract
(see grassHelp("r.stream.extract")
)
if (grassStarted()) {
# Setup
library(terra)
# Example data
madElev <- fastData("madElev")
# Convert a SpatRaster to a GRaster
elev <- fast(madElev)
# Calculate stream channels
streams <- streams(elev)
plot(streams)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.