Delineating water bodies and tracking moisture conditions are
foundational tasks in hydrology, wetland monitoring, and irrigation
management. GeoIndexR implements three key indices:
McFeeters designed NDWI to delineate open water features by maximizing green band reflectance and minimizing NIR reflectance:
\[\text{NDWI} = \frac{\text{GREEN} - \text{NIR}}{\text{GREEN} + \text{NIR}}\]
Water bodies typically have positive NDWI values (\(\text{NDWI} > 0\)), while terrestrial vegetation and dry soil display negative values.
library(GeoIndexR)
img <- get_example_data()
ndwi <- geo_index(img, "NDWI")
index_summary(ndwi)
#>
#> === GeoIndexR Spectral Summary ===
#>
#> index min max mean median sd q05 q25 q75 q95 na_pct
#> NDWI -0.8455 0.7243 -0.228 -0.2392 0.513 -0.8015 -0.7592 0.3265 0.569 1
#> total_cells
#> 100In urbanized and complex landscapes, built-up surfaces often produce false positive signals under classical NDWI. Xu (2006) replaced the NIR band with the Shortwave Infrared (SWIR) band:
\[\text{MNDWI} = \frac{\text{GREEN} - \text{SWIR}}{\text{GREEN} + \text{SWIR}}\]
Because built-up areas reflect strongly in SWIR, their MNDWI values are negative, clearly separating urban structures from open water.
mndwi <- geo_index(img, "MNDWI")
index_summary(mndwi)
#>
#> === GeoIndexR Spectral Summary ===
#>
#> index min max mean median sd q05 q25 q75 q95 na_pct
#> MNDWI -0.5776 0.8329 -0.0413 -0.3182 0.5172 -0.494 -0.4105 0.645 0.7964 1
#> total_cells
#> 100The Normalized Difference Moisture Index monitors vegetation liquid water content:
\[\text{NDMI} = \frac{\text{NIR} - \text{SWIR}}{\text{NIR} + \text{SWIR}}\]
Higher values indicate well-hydrated vegetation canopies, whereas low or negative values signal drought or water stress.
ndmi <- geo_index(img, "NDMI")
index_summary(ndmi)
#>
#> === GeoIndexR Spectral Summary ===
#>
#> index min max mean median sd q05 q25 q75 q95 na_pct
#> NDMI -0.3523 0.6916 0.2813 0.4287 0.3275 -0.2766 -0.0806 0.5354 0.6531 1
#> total_cells
#> 100We can compute and compare water and moisture indices together:
water_stack <- geo_indices(img, c("NDWI", "MNDWI", "NDMI"))
index_summary(water_stack)
#>
#> === GeoIndexR Spectral Summary ===
#>
#> index min max mean median sd q05 q25 q75 q95
#> NDWI -0.8455 0.7243 -0.2280 -0.2392 0.5130 -0.8015 -0.7592 0.3265 0.5690
#> MNDWI -0.5776 0.8329 -0.0413 -0.3182 0.5172 -0.4940 -0.4105 0.6450 0.7964
#> NDMI -0.3523 0.6916 0.2813 0.4287 0.3275 -0.2766 -0.0806 0.5354 0.6531
#> na_pct total_cells
#> 1 100
#> 1 100
#> 1 100