Application of Geospatial Techniques for Visualization and Analysis to Interpret Geo-Coded Images to Enhance Watershed Development Outcomes
WatershedScope is a full-stack geospatial web application for watershed delineation, satellite-image analysis, thematic mapping, and field verification.
The application allows users to select a pour point, delineate an upstream watershed using Digital Elevation Model (DEM) data, discover Sentinel-2 satellite scenes, generate vegetation and water-related indices, extract drainage networks, perform watershed-level statistics, and visualize geo-coded field photographs on an interactive map.
The system is primarily designed as a research and educational demonstrator for watershed monitoring, particularly for semi-arid regions of India.
Watershed development requires reliable spatial information about:
- Land use and land cover
- Drainage networks
- Vegetation condition
- Surface water
- Elevation and terrain
- Changes over time
- Field-level observations
Traditional watershed monitoring often depends heavily on manual field surveys. While geo-coded field photographs are routinely collected, they are frequently treated only as documentation rather than as spatially connected evidence.
WatershedScope connects these field observations with remotely sensed and terrain data through a single interactive geospatial interface.
- Cloud-Based Raster Access β Reads Sentinel-2 and Copernicus DEM data through HTTP range requests instead of downloading complete datasets.
- On-Demand Watershed Delineation β Generates catchment boundaries from a user-selected pour point.
- Drainage Extraction β Derives stream networks from flow-accumulation data.
- Thematic Mapping β Generates RGB, NDVI, NDWI, MNDWI, water-mask, and land-cover layers.
- Temporal Analysis β Compares vegetation conditions between satellite scenes.
- Field Verification β Maps geo-coded photographs to their geographic locations.
- Watershed Statistics β Provides summary statistics for the selected watershed.
| Feature | Description |
|---|---|
| Watershed Delineation | Select a pour point and generate the upstream catchment boundary using DEM-derived hydrological analysis. |
| Drainage Network | Extract stream networks using configurable flow-accumulation thresholds. |
| Satellite Scene Discovery | Discover available Sentinel-2 L2A scenes for a selected location and date range. |
| Thematic Layers | Generate True Color, NDVI, NDWI, MNDWI, Water Mask, and Land Cover layers. |
| Change Detection | Calculate NDVI differences between two selected satellite scenes. |
| Zonal Statistics | Calculate watershed area, mean NDVI, vegetation fraction, water fraction, land-cover distribution, and elevation statistics. |
| Geo-Coded Image Registry | Upload field photographs and automatically extract GPS information from EXIF metadata when available. |
| Interactive Mapping | Visualize watershed boundaries, drainage networks, satellite-derived layers, and field photographs together. |
| Basemap Integration | Uses ESRI World Imagery as the default satellite basemap. |
ββββββββββββββββββββββββββββββββββββββββ
β React + Leaflet SPA β
β Vite : 5173 β
ββββββββββββββββββββ¬ββββββββββββββββββββ
β
/api/* Proxy
β
βΌ
ββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β Port 8000 β
βββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ
β Analysis β β Tile Renderer β β SQLite Store β
β Engine β β β β β
β β β Raster β PNG β β Jobs β
β pysheds β β Web Mercator β β Watersheds β
β NumPy β β β β Geo-coded β
β scikit-image β β β β Images β
βββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββββββββββββ
β β
ββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β Remote Cloud Raster Data β
β β
β β’ Sentinel-2 L2A β
β β’ Copernicus DEM 30 m β
βββββββββββββββββββββββββββββββββββββββ
WatershedScope is designed to read raster data dynamically rather than downloading complete datasets.
Sentinel-2 Level-2A imagery is used for:
- True Color visualization
- NDVI
- NDWI
- MNDWI
- Water detection
- Land-cover clustering
- Temporal change detection
Copernicus DEM 30 m data is used for:
- Elevation analysis
- Flow-direction calculation
- Flow-accumulation calculation
- Watershed delineation
- Drainage-network extraction
The application accesses remote Cloud Optimized GeoTIFF (COG) resources using GDAL/rasterio HTTP range requests where supported.
The application avoids downloading complete source datasets locally. Only the raster windows required for the current analysis are requested, while processing may still require temporary memory or local resources.
- Python 3.10+
- Node.js 18+
- npm
- Git
cd backend
pip install -r requirements.txt
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000The API will be available at:
http://localhost:8000
FastAPI documentation:
http://localhost:8000/docs
cd frontend
npm install
npm run devThe frontend will be available at:
http://localhost:5173
The Vite development server proxies /api requests to the FastAPI backend.
Install the test dependencies:
cd backend
pip install pytest httpxRun the test suite:
python -m pytest tests/ -qLong-running operations such as watershed delineation and satellite-scene discovery are handled through background jobs.
A typical workflow is:
Create Job
β
Receive Job ID
β
Poll /api/jobs/{id}
β
Job Running
β
Job Succeeded / Failed
β
Read Result
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/watershed/delineate |
Creates a watershed delineation job from {lat, lon}. |
GET |
/api/watershed/{id} |
Returns persisted watershed GeoJSON. |
GET |
/api/watershed/{id}/stats?scene= |
Calculates watershed statistics for a selected scene. |
GET |
/api/drainage/{id}?threshold= |
Returns the extracted drainage network as GeoJSON. |
GET |
/api/scenes?lat=&lon=&start=&end= |
Discovers Sentinel-2 scenes for a location and date range. |
GET |
/api/jobs/{id} |
Returns the status and result of a background job. |
GET |
/api/jobs?limit= |
Returns recent jobs. |
GET |
/api/layers/{scene}/{kind}/{z}/{x}/{y}.png |
Returns a rendered thematic map tile. |
GET |
/api/change/{sceneA}/{sceneB}/ndvi/{z}/{x}/{y}.png |
Returns an NDVI change-detection tile. |
GET |
/api/images |
Lists registered geo-coded images. |
POST |
/api/images |
Uploads and registers a field photograph. |
DELETE |
/api/images/{id} |
Deletes a registered image. |
Implementation note: If
/api/scenesactually creates a background job, consider changing this endpoint toPOST /api/scenesfor clearer REST semantics. If the currentGETimplementation is intentional, keep the existing endpoint and document that behavior explicitly.
Click anywhere on the map to place the pour point.
Click Delineate Watershed.
The backend processes the DEM and returns the upstream catchment boundary.
Click Discover Scenes and specify the required date range.
Available Sentinel-2 scenes are displayed for the selected location.
Select a satellite scene and enable layers such as:
- True Color
- NDVI
- NDWI
- MNDWI
- Water Mask
- Land Cover
Click Drainage Network to extract and display streams based on the configured flow-accumulation threshold.
Use Compute Statistics to calculate watershed-level metrics including vegetation, water, elevation, and land-cover information.
Upload geo-coded photographs through the Geo-Coded Images panel.
When GPS coordinates are present in EXIF metadata, they can be associated with the photograph and displayed on the map.
The main geospatial processing pipeline is:
Pour Point
β
βΌ
Copernicus DEM
β
βΌ
DEM Preprocessing
β
βββ Depression Filling
β
βββ Flow Direction
β
βββ Flow Accumulation
β
βΌ
Watershed Delineation
β
βββ Catchment Boundary
β
βββ Drainage Network
β
βΌ
Sentinel-2 Scene Selection
β
βββ NDVI
βββ NDWI
βββ MNDWI
βββ Water Mask
βββ Land Cover
β
βΌ
Watershed Statistics
β
βββ Temporal Change Analysis
backend/
βββ app/
β βββ main.py # FastAPI application and API routes
β βββ jobs.py # SQLite-backed background job management
β βββ watershed.py # Watershed delineation and drainage extraction
β βββ dem.py # Copernicus DEM data access
β βββ sentinel.py # Sentinel-2 scene discovery
β βββ analysis.py # Spectral indices, clustering, change detection
β βββ tiles.py # Dynamic Web Mercator tile rendering
β βββ stats.py # Watershed statistics
β βββ images.py # Image registry and EXIF GPS extraction
β βββ config.py # Application and data-source configuration
β
βββ tests/
β βββ ... # Backend tests
β
βββ requirements.txt
frontend/
βββ src/
β βββ App.jsx # Main application interface
β βββ api.js # Backend API client
β βββ styles.css # Application styles
β
βββ package.json
βββ vite.config.js # Vite configuration and API proxy
docs/
βββ superpowers/
βββ specs/
βββ ... # Application design documentation
- React
- Vite
- Leaflet
- JavaScript / JSX
- CSS
- FastAPI
- Python
- SQLite
- rasterio
- GDAL
- NumPy
- pysheds
- scikit-image
- scikit-learn
- Sentinel-2 Level-2A
- Copernicus DEM 30 m
- Cloud Optimized GeoTIFFs
- GeoJSON
- Web Mercator map tiles
WatershedScope is a research and educational demonstrator, not production-grade hydrological or surveying software.
Results can be affected by:
- DEM resolution and quality
- Pour-point accuracy
- Hydrological preprocessing
- Flow-accumulation threshold selection
- Satellite-image availability
- Cloud contamination
- Spatial resolution of satellite bands
- Land-cover clustering assumptions
- Coordinate transformations and area calculations
The generated watershed boundaries and derived thematic layers should therefore be treated as analytical estimates rather than authoritative engineering or regulatory products.
Remote raster processing can be slower than processing locally cached datasets.
In particular:
- First-time DEM requests may take longer.
- Satellite scene discovery may take approximately 30β60 seconds depending on the query and remote data source.
- Large watershed extents require more raster data to be read and processed.
- Thematic tiles may require repeated raster reads.
- Application-level caching can improve repeated requests.
WatershedScope is primarily designed around watershed-analysis use cases in India, including semi-arid regions.
The underlying geospatial workflow can also operate in other regions where suitable DEM and Sentinel-2 data are available, subject to data availability, coordinate systems, and processing limitations.
This project is licensed under the MIT License.
WatershedScope is intended for research, education, experimentation, and visualization.
It should not be used as the sole basis for:
- Engineering decisions
- Flood-risk certification
- Government watershed boundaries
- Land or property disputes
- Regulatory decisions
- Infrastructure design
- Survey-grade measurements
Always validate analytical results against authoritative datasets and appropriate field measurements before making operational decisions.