Geospatial Index Library
Comprehensive reference for spectral, environmental, and terrain indices. Every index includes its mathematical formula, physical interpretation, practical applications, and known limitations.
import numpy as np
import rasterio
# Open the Red and NIR bands
with rasterio.open('sentinel2_B04.tif') as red_src:
red = red_src.read(1).astype('float32')
with rasterio.open('sentinel2_B08.tif') as nir_src:
nir = nir_src.read(1).astype('float32')
# Avoid division by zero
np.seterr(divide='ignore', invalid='ignore')
# Compute NDVI
ndvi = (nir - red) / (nir + red)
# Handle NaNs
ndvi = np.nan_to_num(ndvi, nan=-1.0)Vegetation Indices
NDVI
Interpretation
Values range from −1 to +1. Dense healthy vegetation yields values 0.6–0.9. Bare soil ~0.1–0.2. Water typically negative.
Applications
Crop health monitoring, deforestation detection, phenology tracking, drought assessment.
Limitations
Saturates in dense canopies (LAI > 3). Sensitive to soil background in sparse vegetation. Atmospheric effects require correction.
ndvi = (nir - red) / (nir + red)EVI
Interpretation
Optimised for high-biomass regions. Standard coefficients: G=2.5, C₁=6, C₂=7.5, L=1. Less prone to saturation than NDVI.
Applications
Tropical forest monitoring, high-biomass agricultural areas, canopy structural analysis.
Limitations
Requires blue band (not available on all sensors). More complex computation.
evi = 2.5 * ((nir - red) / (nir + 6 * red - 7.5 * blue + 1))SAVI
Interpretation
L is a soil brightness correction factor (typically 0.5). Reduces soil background noise for sparse vegetation.
Applications
Arid/semi-arid regions, early crop growth stages, rangeland monitoring.
Limitations
Requires empirical selection of L. Less effective for dense vegetation.
L = 0.5
savi = ((nir - red) / (nir + red + L)) * (1 + L)GNDVI
Interpretation
More sensitive to chlorophyll concentration than NDVI. Useful for assessing nitrogen status.
Applications
Precision agriculture, chlorophyll estimation, crop nitrogen management.
Limitations
Less documented in literature compared to NDVI. Can saturate at very high chlorophyll levels.
gndvi = (nir - green) / (nir + green)VIIRS
Interpretation
Provides radiometric data from the VIIRS instrument aboard Suomi-NPP and NOAA-20.
Applications
Nighttime lights, fire detection, ocean color, sea surface temperature.
Limitations
Coarser resolution than Sentinel-2 or Landsat for land applications.
# Pseudo-code for fetching VIIRS data
viirs_data = client.get_viirs(band='DNB', date='2026-05-01')Water Indices
NDWI
Interpretation
Positive values indicate water bodies. Originally proposed by McFeeters (1996).
Applications
Surface water mapping, flood extent delineation, wetland monitoring.
Limitations
Can be confused by built-up areas. Modified NDWI (MNDWI using SWIR) often preferred.
ndwi = (green - nir) / (green + nir)MNDWI
Interpretation
Better discrimination between water and built-up areas than NDWI. Positive for water, negative for built-up.
Applications
Urban water body mapping, improved flood mapping in built environments.
Limitations
Requires SWIR band. Mixed pixels at water-land boundaries.
mndwi = (green - swir) / (green + swir)Soil & Fire Indices
NBSI
Interpretation
Highlights bare soil by exploiting reflectance contrast between SWIR and visible green bands.
Applications
Desertification monitoring, mining reclamation, construction site detection.
Limitations
May confuse dry vegetation with bare soil in arid environments.
nbsi = (swir1 - green) / (swir1 + green)NBR2
Interpretation
Sensitive to changes in vegetation moisture and burn severity using two SWIR bands.
Applications
Burn severity assessment, post-fire recovery monitoring, wildfire damage mapping.
Limitations
Less effective under cloud cover. Requires both SWIR bands.
nbr2 = (swir1 - swir2) / (swir1 + swir2)NDI7
Interpretation
Sensitive to moisture content in both vegetation and soil. Useful for drought monitoring.
Applications
Fuel moisture estimation, fire risk assessment, drought mapping.
Limitations
Atmospheric correction critical for SWIR bands. Limited to sensors with SWIR2 band.
ndi7 = (nir - swir2) / (nir + swir2)Terrain Indices
TWI
Interpretation
Where a = upslope contributing area per unit contour length and β = local slope angle. Higher TWI indicates areas prone to saturation.
Applications
Hydrological modelling, soil moisture prediction, wetland delineation.
Limitations
Assumes steady-state conditions. Sensitive to DEM resolution and flow direction algorithm.
import numpy as np
twi = np.log(upslope_area / np.tan(slope))TPI
Interpretation
Difference between elevation at a point and mean elevation of surrounding neighbourhood. Positive = ridge, negative = valley.
Applications
Landform classification, habitat mapping, erosion risk assessment.
Limitations
Results depend heavily on neighbourhood size selection.
import scipy.ndimage as nd
mean_z = nd.uniform_filter(elevation, size=3)
tpi = elevation - mean_zWorking towards it: Additional indices (ARVI, MSAVI2, BSI, NDBI, UI, NDSI, TSAVI, WDRVI, CIgreen, CIred-edge) and full terrain analysis suite (curvature, roughness, hillshade, flow accumulation) are being documented.