#--- 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
)
Run the code above in your browser using DataLab