View source: R/utils_mosaic.R View source: R/utils_mapedit.R
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 = 4, nir = 5)
mosaic |
A mosaic of class |
index |
The index to use for the index view. Defaults to "B". |
r |
The layer for the Red band (default: 3). |
g |
The layer for the Green band (default: 2). |
b |
The layer for the Blue band (default: 1). |
re |
The layer for the Red-edge band (default: 4). |
nir |
The layer for the Near-infrared band(default: 5). |
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)
library(terra)
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
confusion <-
matrix(rnorm(90*95, 100, 30),
nrow = nrow(mosaic),
ncol = ncol(mosaic))
confusion <- mosaic_input(confusion)
terra::ext(confusion) <- terra::ext(mosaic)
terra::crs(confusion) <- terra::crs(mosaic)
names(confusion) <- "confusion"
two_layers <- c(mosaic, confusion)
final <- mosaic_index(two_layers, "B+R", b = 1, r = 2)
mosaic_view(mosaic_input(final), viewer = "base")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.