Converts a matrix or SpatRaster into a landscape object that can be used with landscape analysis functions.
Arguments
- data
Matrix or SpatRaster containing landscape data
- pattern
Character string specifying the landscape pattern if known (default NA).
- name
Character string specifying the landscape name to distinguish it from other landscapes (default NA).
- params
List of parameters used to create the landscape. Can be empty but will be filled if landscapes are created automatically by the
create_landscapesor thecreate_landscapesfunction. Default is NULL.
See also
create_landscape, create_landscapes
Other landscape objects:
plot.landscape(),
print.landscape(),
set_landscape_name(),
set_landscape_pattern()
Examples
# Create from a matrix
mat <- matrix(runif(100), nrow = 10, ncol = 10)
l <- landscape(mat)
# Create with pattern and name
l <- landscape(mat, pattern = "random", name = "test_landscape")
# Create with parameters
l <- landscape(
mat,
pattern = "sharp",
name = "alpine_treeline",
params = list(boundary_position = 0.5, rotation = 0)
)
# Create from SpatRaster
rast <- terra::rast(mat)
l <- landscape(rast, name = "my_raster")