stac_compute_index
Compute spectral indices like NDVI or NDWI from satellite imagery by automatically downloading required bands and applying the index formula, returning a single-band raster.
Instructions
Compute a spectral index (e.g., NDVI, NDWI) for a scene.
Automatically downloads the required bands, computes the index formula, and stores the result as a single-band float32 raster.
Supported indices:
ndvi: Vegetation (NIR - Red) / (NIR + Red)
ndwi: Water (Green - NIR) / (Green + NIR)
ndbi: Built-up (SWIR16 - NIR) / (SWIR16 + NIR)
evi: Enhanced Vegetation 2.5*(NIR - Red) / (NIR + 6Red - 7.5Blue + 1)
savi: Soil-Adjusted Vegetation ((NIR - Red) / (NIR + Red + 0.5)) * 1.5
bsi: Bare Soil ((SWIR16 + Red) - (NIR + Blue)) / ((SWIR16 + Red) + (NIR + Blue))
Args: scene_id: Scene identifier from a previous search index_name: Index to compute (ndvi, ndwi, ndbi, evi, savi, bsi) bbox: Optional crop bbox in EPSG:4326 [west, south, east, north] cloud_mask: Apply SCL-based cloud masking before computation (Sentinel-2 only) output_format: Output format - "geotiff" (default) or "png" output_mode: Response format - "json" (default) or "text"
Returns: JSON with artifact_ref and value_range for the computed index
Tips for LLMs: - Use stac_capabilities to see all available indices and required bands - Interpretation guide: - NDVI: >0.6 dense vegetation, 0.2-0.6 moderate, <0.2 bare/water - NDWI: >0 water, <0 land; useful for flood mapping - NDBI: >0 built-up, <0 natural land cover - EVI: similar to NDVI but corrects for atmospheric and soil effects - SAVI: like NDVI but better in areas with sparse vegetation - BSI: >0 bare soil, <0 vegetated - Only works for optical collections (Sentinel-2, Landsat) - Enable cloud_mask=True for cleaner results with Sentinel-2 data - For temporal change analysis, compute the same index on multiple dates and compare value_range
Example: ndvi = await stac_compute_index( scene_id="S2B_...", index_name="ndvi", bbox=[0.85, 51.85, 0.95, 51.92] )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | No | ||
| scene_id | Yes | ||
| cloud_mask | No | ||
| index_name | Yes | ||
| output_mode | No | json | |
| output_format | No | geotiff |