Extract EII for a Polygon
This tutorial shows how to extract Ecosystem Integrity Index statistics for any area of interest.
Prerequisites
- Installed
ecosystem-integrity-indexpackage - Authenticated with Google Earth Engine
Step 1: Define Your Area of Interest
You can define an area using coordinates:
import ee
ee.Initialize(project='your-project')
# Option 1: Rectangle from bounds
polygon = ee.Geometry.Rectangle([-60, -10, -55, -5])
# Option 2: Polygon from coordinates
polygon = ee.Geometry.Polygon([
[[-60, -10], [-55, -10], [-55, -5], [-60, -5], [-60, -10]]
])
# Option 3: From a FeatureCollection
countries = ee.FeatureCollection("FAO/GAUL/2015/level0")
brazil = countries.filter(ee.Filter.eq('ADM0_NAME', 'Brazil')).geometry()
Step 2: Extract EII Statistics
from eii.client import get_stats
# Get statistics
stats = get_stats(polygon, stats=["mean", "min", "max"])
print(stats)
Output:
{
"geometry_type": "Polygon",
"values": {
"eii": {"mean": 0.72, "min": 0.1, "max": 1.0},
"functional_integrity": {"mean": 0.8, "min": 0.2, "max": 1.0},
"structural_integrity": {"mean": 0.6, "min": 0.1, "max": 1.0},
"compositional_integrity": {"mean": 0.7, "min": 0.3, "max": 1.0}
}
}
Step 3: Return EII Only (Optional)
Next Steps
- Regional Analysis - Analyze multiple regions
- API Reference - Full function documentation