spectralIndices(img, blue = NULL, green = NULL, red = NULL, nir = NULL,
swir1 = NULL, swir2 = NULL, indices = NULL, index = NULL,
coefs = list(L = 0.5, G = 2.5, L_evi = 1, C1 = 6, C2 = 7.5, s = 1), ...)
indices
.spectralIndices
calculates all indices in one go, i.e. one call to overlay, which is far more efficient, than calculating each index separately (for large rasters).
By default all indices which can be calculated given the specified indices will be calcultated. If you don't want all indices, use the indices
argument to specify exactly which indices are to be calculated.
See the table bellow for index names and required bands.coefs
can be used to redefine additional coefficients used to calculate EVI
(L_evi, C1, C2, G
), and SAVI
(L
).
Although the defaults are sensible values, it can make sense to adjust the SAVI soil brigthness factor L
depending on the characteristics of the vegetation cover in your scene.
red, nir
$s * nir - red$
CTVI Corrected Transformed Vegetation Index Perry1984 red, nir
$(nir - red)/(nir + red) + 0.5$
EVI Enhanced Vegetation Index Huete1999 red, nir, blue
$G * ((nir - red)/(nir + C1 * red - C2 * blue + L_evi))$
GEMI Global Environmental Monitoring Index Pinty1992 red, nir
$(((nir^2 - red^2) * 2 + (nir * 1.5) + (red * 0.5))/(nir + red + 0.5)) * (1 - ((((nir^2 - red^2) * 2 + (nir * 1.5) + (red * 0.5))/(nir + red + 0.5)) * 0.25)) - ((red - 0.125)/(1 - red))$
LSWI Land Surface Water Index Xiao2004 nir, swir1
$(nir - swir1)/(nir + swir1)$
MNDWI Modified Normalised Difference Water Index green, swir1
$(green - swir1)/(green + swir1)$
MSAVI Modified Soil Adjusted Vegetation Index Qi1994 red, nir
$nir + 0.5 - (0.5 * sqrt((2 * nir + 1)^2 - 8 * (nir - (2 * red))))$
MSAVI2 Modified Soil Adjusted Vegetation Index 2 Qi1994 red, nir
$(2 * (nir + 1) - sqrt((2 * nir + 1)^2 - 8 * (nir - red)))/2$
NBRI Normalised Burn Ratio Index nir, swir2
$(nir - swir2)/(nir + swir2)$
NDVI Normalised Difference Vegetation Index Rouse1974 red, nir
$(nir - red)/(nir + red)$
NDWI Normalised Difference Water Index Gao1996 green, nir
$(green - nir)/(green + nir)$
NRVI Normalised Ratio Vegetation Index Baret1991 red, nir
$(red/nir - 1)/(red/nir + 1)$
RVI Ratio Vegetation Index red, nir
$red/nir$
SATVI Soil Adjusted Total Vegetation Index red, swir1, swir2
$(swir1 - red)/(swir1 + red + L) * (1 + L) - (swir2/2)$
SAVI Soil Adjusted Vegetation Index Huete1988 red, nir
$(nir - red) * (1 + L)/(nir + red + L)$
SLAVI Specific Leaf Area Vegetation Index Lymburger2000 red, nir, swir2
$nir/(red + swir2)$
SR Simple Ratio Vegetation Index Birth1968 red, nir
$nir/red$
TVI Transformed Vegetation Index Deering1975 red, nir
$sqrt((nir - red)/(nir + red) + 0.5)$
TTVI Thiam's Transformed Vegetation Index Thiam1997 red, nir
$sqrt(abs((nir - red)/(nir + red) + 0.5))$
WDVI Weighted Difference Vegetation Index Richardson1977 red, nir
$nir - s * red$
DVI Difference Vegetation Index Richardson1977 red, nir
$s * nir - red$ }
overlay
library(ggplot2)
data(rlogo)
rlogo[["nir"]] <- rlogo[[2]] + 100
SI <- spectralIndices(rlogo, red = "red", nir = "nir", indices = "NDVI")
ggR(SI, geom_raster = TRUE) +
scale_fill_gradient(low = "white", high = "green", na.value = NA)
Run the code above in your browser using DataLab