| geo_index | R Documentation |
Calculates a specified spectral or geospatial index from a terra::SpatRaster
object or a raster file path. Band names are automatically resolved using heuristic
matching, sensor presets, or explicit user mapping.
geo_index(image, index, bands = NULL, scale_factor = NULL, sensor = NULL, ...)
image |
A |
index |
Character string specifying the index to compute (case-insensitive,
e.g., |
bands |
Optional named vector or list specifying custom band mapping
(e.g., |
scale_factor |
Optional numeric scaling divisor (e.g., |
sensor |
Optional character string specifying a sensor preset for automatic
band name resolution (e.g., |
... |
Additional parameters passed to the index calculation function
(e.g., soil adjustment factor |
A single-layer terra::SpatRaster object containing the computed
index values, with layer name set to the uppercase index code, preserving all
original spatial properties (CRS, resolution, extent, dimensions).
img <- get_example_data()
# 1. Compute NDVI
ndvi <- geo_index(img, "NDVI")
print(ndvi)
# 2. Compute SAVI with custom parameter
savi <- geo_index(img, "SAVI", L = 0.5)
# 3. Compute EVI with scale factor for raw DN values
evi <- geo_index(img, "EVI", scale_factor = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.