mosaic_index: Mosaic Index

View source: R/utils_mosaic.R View source: R/utils_mapedit.R

mosaic_indexR Documentation

Mosaic Index

Description

Compute or extract an index layer from a multi-band mosaic raster.

Usage

mosaic_index(mosaic, index = "R", r = 3, g = 2, b = 1, re = 4, nir = 5)

Arguments

mosaic

A mosaic of class SpatRaster, generally imported with mosaic_input().

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).

Details

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.

Value

An index layer extracted/computed from the mosaic raster.

Examples

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")


pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to mosaic_index in pliman...