lsp_extract | R Documentation |
Extracts a local landscape from categorical raster data based on its id and provided window
argument.
lsp_extract(x, window, id)
x |
Object of class |
window |
Specifies areas for analysis. It can be either: |
id |
Id of the local landscape - it is possible to find in the output of |
A stars
or terra
object cropped to the extent of a selected local landscape
library(stars)
landform = read_stars(system.file("raster/landforms.tif", package = "motif"))
ecoregions = read_sf(system.file("vector/ecoregionss.gpkg", package = "motif"))
extract1 = lsp_extract(x = landform, window = 100, id = 25)
plot(extract1)
ecoregions = st_transform(ecoregions, st_crs(landform))
extract2 = lsp_extract(x = landform, window = ecoregions["id"], id = 11)
plot(extract2)
# larger data example
library(stars)
landform = read_stars(system.file("raster/landform.tif", package = "motif"))
ecoregions = read_sf(system.file("vector/ecoregions.gpkg", package = "motif"))
extract1 = lsp_extract(x = landform, window = 100, id = 1895)
plot(extract1)
ecoregions = st_transform(ecoregions, st_crs(landform))
extract2 = lsp_extract(x = landform, window = ecoregions["id"], id = 7)
plot(extract2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.