strat_map {sgsR} | R Documentation |
Map a raster stack of a list of rasters
Description
Map stratified rasters to a combined stratification.
Usage
strat_map(
sraster,
stack = FALSE,
filename = NULL,
overwrite = FALSE,
plot = FALSE,
details = FALSE
)
Arguments
sraster |
spatRaster or list. Stratification raster stack or list of rasters. If |
stack |
Logical. Default = |
filename |
Character. Path to write stratified raster to disc. |
overwrite |
Logical. Specify whether |
plot |
Logical. Plots output strata raster and visualized strata with boundary dividers. |
details |
Logical. If |
Value
A spatRaster object.
Mapping
The mapping algorithm will take the stratification from sraster
and combine it with
overlying strata values across all layers. This will result in a strata
attribute
where the values from all inputs are combined.
i.e.
If strata_1 = 1
and strata_2 = 1
then strata = 11
.
If strata_1 = 2
and strata_2 = 14
then strata = 214
.
If strata_1 = "A"
and strata_2 = 14
then strata = "A14"
.
Author(s)
Tristan R.H. Goodbody, Tommaso Trotto, Robert Hijmans
See Also
Other stratify functions:
strat_breaks()
,
strat_kmeans()
,
strat_poly()
,
strat_quantiles()
Examples
#--- load input metrics rasters ---#
raster <- system.file("extdata", "sraster.tif", package = "sgsR")
sraster <- terra::rast(raster)
#--- read polygon coverage ---#
poly <- system.file("extdata", "inventory_polygons.shp", package = "sgsR")
fri <- sf::st_read(poly)
#--- stratify polygon coverage ---#
#--- specify polygon attribute to stratify ---#
attribute <- "NUTRIENTS"
#--- specify features within attribute & how they should be grouped ---#
#--- as a single vector ---#
features <- c("poor", "rich", "medium")
srasterfri <- strat_poly(
poly = fri,
attribute = attribute,
features = features,
raster = sraster
)
#--- map srasters with raster stack ---#
stack <- c(srasterfri, sraster)
strat_map(
sraster = stack
)
#--- map sraster with list of rasters ---#
rast_list <- list(srasterfri, sraster)
strat_map(
sraster = rast_list,
stack = TRUE,
details = TRUE
)