Spatialize landscape metric values
Usage
spatialize_lsm(
landscape,
level = "patch",
metric = NULL,
name = NULL,
type = NULL,
what = NULL,
directions = 8,
progress = FALSE,
to_disk = getOption("to_disk", default = FALSE),
...
)
Arguments
- landscape
A categorical raster object: SpatRaster; Raster* Layer, Stack, Brick; stars or a list of SpatRasters.
- level
Level of metrics. Either 'patch', 'class' or 'landscape' (or vector with combination).
- metric
Abbreviation of metrics (e.g. 'area').
- name
Full name of metrics (e.g. 'core area')
- type
Type according to FRAGSTATS grouping (e.g. 'aggregation metrics').
- what
Selected level of metrics: either "patch", "class" or "landscape". It is also possible to specify functions as a vector of strings, e.g.
what = c("lsm_c_ca", "lsm_l_ta")
.- directions
The number of directions in which patches should be connected: 4 (rook's case) or 8 (queen's case).
- progress
Print progress report.
- to_disk
If TRUE raster will be saved to disk.
- ...
Arguments passed on to
calculate_lsm()
.
Details
The functions returns a nested list with RasterLayer
s. The first level
contains each input layer (only one element if RasterLayer
was provided).
The second level contains a RasterLayer
for each selected metric
(see list_lsm
for details) where each cell has the landscape metric
value of the patch it belongs to. Only patch level metrics are allowed.
Examples
landscape <- terra::rast(landscapemetrics::landscape)
spatialize_lsm(landscape, what = "lsm_p_area")
#> Warning: Please use 'check_landscape()' to ensure the input data is valid.
#> $layer_1
#> $layer_1$lsm_p_area
#> class : SpatRaster
#> dimensions : 30, 30, 1 (nrow, ncol, nlyr)
#> resolution : 1, 1 (x, y)
#> extent : 0, 30, 0, 30 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source(s) : memory
#> name : value
#> min value : 0.0001
#> max value : 0.0159
#>
#>