mosaic_index | R Documentation |
Compute or extract an index layer from a multi-band mosaic raster.
mosaic_index(
mosaic,
index = "R",
r = 3,
g = 2,
b = 1,
re = NA,
nir = NA,
swir = NA,
tir = NA,
plot = TRUE,
in_memory = TRUE,
workers = 1
)
mosaic |
A mosaic of class |
index |
A character value (or a vector of characters) specifying the
target mode for conversion to a binary image. Use |
r , g , b , re , nir , swir , tir |
The red, green, blue, red-edge, near-infrared, shortwave Infrared, and thermal infrared bands of the image, respectively. By default, the function assumes a BGR as input (b = 1, g = 2, r = 3). If a multispectral image is provided up to seven bands can be used to compute built-in indexes. There are no limitation of band numbers if the index is computed using the band name. |
plot |
Plot the computed index? Defaults to |
in_memory |
Logical, indicating whether the indexes should be computed
in memory. Defaults to |
workers |
numeric. The number of workers you want to use for parallel processing when computing multiple indexes. |
This function computes or extracts an index layer from the input
mosaic raster based on the specified index name. If the index is not found
in the package's predefined index list (see image_index()
for more
details), it attempts to compute the index using the specified band
indices. The resulting index layer is returned as an SpatRaster
object.
An index layer extracted/computed from the mosaic raster.
library(pliman)
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
names(mosaic)
elev2 <- mosaic_index(mosaic, "elevation * 5", plot = FALSE)
oldpar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
mosaic_plot(mosaic)
mosaic_plot(elev2)
# return the original parameters
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.