Skip to content

gauranggupta0786/WaterSemanticSegmentation

Repository files navigation

Water Body Detection using MNDWI (Google Earth Engine + Flask)

Overview

This project is a web-based application that detects and analyzes water bodies from satellite imagery using the Modified Normalized Difference Water Index (MNDWI). It uses Google Earth Engine (GEE) for geospatial computation and Flask for backend deployment.

Users can:

  • Select a date
  • Draw a region of interest (ROI)
  • Detect water bodies
  • View total area and count
  • Download results as GeoJSON

Features

  • Interactive map (Leaflet.js)
  • Real-time Sentinel-2 imagery
  • Water detection using MNDWI
  • Computes:
  • Number of water bodies
  • Total area (sq. km)
  • GeoJSON export
  • Map visualization with overlays

Methodology

Data Source

  • Sentinel-2 Harmonized dataset (Google Earth Engine)

Processing Steps

  1. Filter images by ROI, date (±15 days), and cloud cover (<30%)
  2. Compute MNDWI: MNDWI = (Green - SWIR) / (Green + SWIR)
  3. Thresholding:
    • Water pixels → MNDWI > 0
  4. Convert raster → vector polygons
  5. Remove small regions (< 100,000 m²)
  6. Merge fragmented water bodies

Tech Stack

Backend

  • Python
  • Flask
  • Google Earth Engine API
  • Geemap

Frontend

  • HTML, CSS
  • Leaflet.js + Leaflet Draw

Geospatial

  • GeoJSON
  • Remote sensing (Sentinel-2)

Project Structure

  1. Root Directory
    a. app.py
    b. requirements.txt

  2. templates/
    a. index.html
    b. result.html
    c. map.html

  3. static/
    a. draw.js
    b. style.css
    c. geojson/
    i. water.geojson j. water_bodies.geojson

Setup Instructions

1. Clone the Repository

git clone https://github.com/gauranggupta0786/WaterSemanticSegmentation.git cd WaterSemanticSegmentation

2. Install Dependencies

pip install -r requirements.txt

3. Authenticate Google Earth Engine

pip install -r requirements.txt

4. Update Project ID

In app.py, replace: ee.Initialize(project='your-project-id')

5. Run the Application

python app.py

Open in browser: http://127.0.0.1:5000/

Author Gaurang Gupta BITS Pilani – Computer Science

About

Web app for semantic segmentation of water bodies using Sentinel-2 imagery via Google Earth Engine. Implements MNDWI-based detection with interactive mapping (Leaflet) and GeoJSON export using a Flask backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages