Working with Vegetation Indices

Learn how to calculate, interpret, and apply vegetation indices like NDVI, EVI, and more for environmental monitoring.

Prerequisites: Before starting this tutorial, make sure you have:
  • An ObservEarth API key
  • Created at least one Area of Interest (AOI)
  • Basic understanding of satellite imagery
If you haven't done these steps yet, check out our Authentication, Areas of Interest, and Sentinel-2 tutorials first.

Introduction to Vegetation Indices

Vegetation indices are mathematical combinations of satellite spectral bands designed to highlight vegetation properties and conditions. They leverage the fact that healthy vegetation reflects strongly in the near-infrared spectrum while absorbing red light.

Benefits of Vegetation Indices:
  • Standardization: Normalize data to allow comparison across different times and sensors
  • Enhancement: Highlight specific vegetation characteristics that might not be visible in raw imagery
  • Quantification: Provide numerical values that can be used for statistical analysis
  • Simplification: Reduce multispectral data to a single value for easier interpretation

Common Vegetation Indices

NDVI (Normalized Difference Vegetation Index)

The most widely used vegetation index, NDVI measures vegetation health and density.

Formula: (NIR - Red) / (NIR + Red)

Value Range: -1 to 1

  • -1 to 0: Non-vegetation (water, snow, clouds, bare soil)
  • 0.1 to 0.3: Sparse vegetation
  • 0.3 to 0.6: Moderate vegetation
  • 0.6 to 1.0: Dense, healthy vegetation

[Image: NDVI map with color scale showing vegetation health]

NDVI visualization showing varying levels of vegetation health across a landscape.


EVI (Enhanced Vegetation Index)

An improved version of NDVI with better sensitivity in high biomass regions and reduced atmospheric influences.

Formula: 2.5 * ((NIR - Red) / (NIR + 6 * Red - 7.5 * Blue + 1))

Value Range: -1 to 1

Advantages over NDVI:

  • Less sensitive to atmospheric conditions
  • Doesn't saturate as easily in dense vegetation
  • Reduces background soil noise

[Image: Comparison of NDVI and EVI over dense forest]

Comparison showing how EVI provides better differentiation in areas of dense vegetation where NDVI saturates.


Other Important Indices
Index Formula Application Value Range
NDMI (Normalized Difference Moisture Index) (NIR - SWIR) / (NIR + SWIR) Vegetation water content, drought monitoring -1 to 1
NDWI (Normalized Difference Water Index) (Green - NIR) / (Green + NIR) Open water detection, water content in leaves -1 to 1
LAI (Leaf Area Index) 3.618 * EVI (simplified) Canopy structure, biomass estimation 0 to 7
SAVI (Soil Adjusted Vegetation Index) (1 + L) * (NIR - Red) / (NIR + Red + L) Areas with significant soil exposure -1 to 1

Calculating Vegetation Indices

Using the ObservEarth API

ObservEarth provides easy access to pre-calculated vegetation indices through our API:

Endpoint for Sentinel-2
GET /api/s2/image/{geometry_id}/
Query Parameters
Parameter Type Required Description
item_id string Yes ID of the satellite image
image_type string Yes Image format (png, jpeg, tiff)
index string Yes Vegetation index (ndvi, evi, ndmi, ndwi, lai)
colormap string No Color palette for visualization

[Image: NDVI visualization with RdYlGn colormap]

NDVI with RdYlGn colormap

[Image: NDVI visualization with Viridis colormap]

NDVI with Viridis colormap

[Image: NDVI visualization with custom colormap]

NDVI with custom colormap

Code Example
import requests
import matplotlib.pyplot as plt
from PIL import Image
from io import BytesIO

api_key = "your_api_key_here"
geometry_id = "123e4567-e89b-12d3-a456-426614174000"
item_id = "S2A_MSIL2A_20230105T123456_N0509_R123_T18TXM_20230105T150000"

url = f"https://observearth.com/api/s2/image/{geometry_id}/"

params = {
    "item_id": item_id,
    "image_type": "png",
    "index": "ndvi",
    "colormap": "RdYlGn",
    "min_value": 0.0,
    "max_value": 0.8
}

headers = {
    "X-API-Key": api_key
}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
    # Display the image
    img = Image.open(BytesIO(response.content))
    plt.figure(figsize=(10, 8))
    plt.imshow(img)
    plt.title("NDVI Visualization")
    plt.axis('off')
    plt.show()
else:
    print(f"Error: {response.status_code}")
    print(response.text)

Interpreting Vegetation Indices

Proper interpretation of vegetation indices requires understanding what they represent and their limitations:

[Image: NDVI time series showing seasonal vegetation changes]

NDVI time series showing seasonal vegetation patterns over a year.

[Image: NDVI anomaly map showing deviation from historical average]

NDVI anomaly map showing areas with vegetation health above or below historical averages.

Interpretation Guidelines:
  • Consider seasonality: Vegetation indices naturally vary throughout the year
  • Use historical context: Compare current values to historical averages
  • Account for vegetation type: Different vegetation types have different baseline values
  • Be aware of limitations: Clouds, shadows, and atmospheric effects can influence results
  • Use multiple indices: Different indices can provide complementary information

Applications

Agricultural Monitoring

[Image: NDVI map showing crop health variations across fields]

Vegetation indices help farmers monitor crop health, detect stress, and optimize irrigation and fertilizer application.

Forest Management

[Image: EVI map showing forest disturbance after a wildfire]

Indices can detect deforestation, monitor forest recovery after disturbances, and assess overall forest health.

Drought Monitoring

[Image: NDMI map showing moisture stress during drought]

Moisture-sensitive indices like NDMI can detect early signs of drought stress in vegetation before visual symptoms appear.

Biodiversity Assessment

[Image: Habitat classification based on vegetation indices]

Vegetation indices can help identify different habitat types and assess ecosystem health and biodiversity.

Next Steps