A web application for detecting surface water and flooding events using free Sentinel-1 SAR (Synthetic Aperture Radar) data from Google Earth Engine.
This application enables users to:
- Draw an Area of Interest (AOI) anywhere on Earth
- Automatically fetch the latest Sentinel-1 SAR imagery
- Detect surface water using adaptive Otsu thresholding
- Visualize results interactively with dual basemap options
- Download detected water polygons as GeoJSON
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend (GitHub Pages) โ
โ - React + Leaflet โ
โ - AOI drawing โ
โ - Basemap toggle โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ GeoJSON AOI + params
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend (Cloud Run) โ
โ - FastAPI โ
โ - Google Earth Engine โ
โ - Sentinel-1 SAR โ
โ - Water detection โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ GeoJSON water polygons
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Visualization โ
โ - Water overlay โ
โ - Metadata display โ
โ - GeoJSON download โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
SAR.Flood.Detection.-.Brave.2026-01-28.13-37-21.mp4
- Adaptive Water Detection: Otsu thresholding automatically adjusts to scene characteristics
- Location Search: Search and navigate to any location worldwide
- GeoJSON Export: Download detected water polygons for further analysis
- Free Data: Uses Copernicus Sentinel-1 SAR via Google Earth Engine
- FastAPI: Modern Python web framework
- Google Earth Engine: SAR imagery access and processing
- Pydantic: Request/response validation
- Google Cloud Run: Serverless deployment
- React 18: UI framework
- Leaflet: Interactive mapping
- Leaflet Draw: AOI drawing tools
- Turf.js: Geospatial calculations
- Axios: API communication
- Python 3.10+
- Google Cloud Platform account
- Google Earth Engine service account
- gcloud CLI (for deployment)
- Node.js 16+
- npm or yarn
Follow the detailed guide in docs/GEE_SETUP.md to:
- Create a GCP project
- Enable Earth Engine API
- Create a service account
- Download credentials JSON
- Set up for local development and Cloud Run
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.example .env
# Edit .env and set:
# GEE_SERVICE_ACCOUNT_PATH=./credentials/gee-service-account.json
# Place your GEE service account JSON in backend/credentials/
# Run locally
python run_local.pyBackend will be available at http://localhost:8000
cd frontend
# Install dependencies
npm install
# Run development server
npm startFrontend will be available at http://localhost:3000
The application includes 2 pre-loaded test locations:
- Venice Lagoon, Italy - Permanent water baseline for algorithm validation
- Lake Mead, Nevada/Arizona - Large reservoir for drought monitoring
Select these from the sidebar to quickly test the application.
# From project root
./deploy.sh
# Or manually:
cd backend
gcloud run deploy sar-flood-api \
--source . \
--region us-central1 \
--platform managed \
--timeout 300s \
--memory 1Gi \
--allow-unauthenticated \
--set-secrets GEE_SERVICE_ACCOUNT=gee-service-account:latestcd frontend
# Update .env.production with your Cloud Run URL
# REACT_APP_API_URL=https://your-cloud-run-url
# Deploy
npm run deployOr use the GitHub Actions workflow (see .github/workflows/deploy-frontend.yml)
- Data Ingestion: Fetch most recent Sentinel-1 GRD imagery (last 30 days)
- Preprocessing:
- Radiometric calibration
- Terrain correction (SRTM)
- dB conversion
- Lee speckle filtering
- Feature Derivation:
- VV and VH polarizations
- VV-VH difference
- Texture (local std dev)
- Slope
- Adaptive Detection:
- Otsu thresholding (or manual override)
- Polarization rules
- Terrain masking
- Texture filtering
- Refinement:
- Morphological operations
- Small object removal
- Geometry simplification
- Vectorization: Convert to GeoJSON polygons
For fine-tuning detection (accessible via collapsible panel):
- End Date: Select a specific date to search for imagery on or before that date (default: latest available)
- Max Slope (degrees): Exclude steep terrain unlikely to retain water (default: 5ยฐ)
- Min Area (pixels): Filter out small noise artifacts (default: 100 pixels)
The algorithm uses adaptive Otsu thresholding which automatically determines the optimal VV backscatter threshold based on the image histogram.
- AOI Size: Maximum 50ร50 km (2500 kmยฒ) for real-time processing
- Temporal: Uses most recent acquisition within specified date range
- Orbit: ASCENDING pass only for consistency
- Resolution: 10m Sentinel-1 ground resolution
- Processing Time: 15-30 seconds depending on AOI size
- No-Water Scenes: Otsu thresholding may incorrectly identify "water" pixels in completely dry areas (unimodal histograms with no actual water present)
- Frozen Water Bodies: Ice and snow on rivers/lakes appear similar to land in SAR imagery, causing frozen water to be missed or misclassified
- High Winds: Wind-roughened water surfaces increase backscatter, reducing detection accuracy or causing water to appear as land
- Vegetation: Dense floating vegetation may mask water presence
- Temporal change detection (before/after flooding)
- Multi-temporal stacking for stability
- Sentinel-2 optical cross-validation
- Permanent water vs flood water classification
- Time-series animation
MIT License - Free for educational and commercial use
- Copernicus Sentinel-1 mission for free SAR data
- Google Earth Engine for cloud-based processing
- OpenStreetMap and Esri for basemap tiles
For questions, issues, or collaborations, please open an issue on GitHub.
Note: This is a demonstration project. For operational flood monitoring, consider additional validation and temporal analysis.