Remote Sensing with GEE – NDWI Extraction (Water Surface Mapping)

GIS Project

This project demonstrates the use of Google Earth Engine (GEE) for extracting water surfaces by computing the Normalized Difference Water Index (NDWI) from Sentinel-2 imagery.

NDWI is an effective spectral index for mapping open water bodies, distinguishing them from surrounding vegetation and built-up areas.

🛠 Tools & Data Used

📌 Processing Steps

Step 1: Load Sentinel-2 Imagery

GIS Project

Sentinel-2 surface reflectance data (COPERNICUS/S2_SR) was filtered by region of interest (ROI), time period, and cloud cover.


var roi = Roi;
var sentinel_Wet = ee.ImageCollection('COPERNICUS/S2_SR')
  .filterDate('2022-06-01','2022-10-30')
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10))
  .filterBounds(roi);

Step 2: Compute NDWI

GIS Project

The NDWI is calculated using the green band (B3) and the near-infrared band (B8) of Sentinel-2:

NDWI = (Green - NIR) / (Green + NIR)


var ndwi = sentinel_Wet.median().normalizedDifference(['B3', 'B8']).rename('NDWI');
Map.addLayer(ndwi, {min:-1, max:1, palette:['brown','white','blue']}, 'NDWI');
  

Step 3: NDWI Thresholding & Classification

The NDWI values in Sentinel-2 typically range from -1 to 1. Water bodies usually have higher values, while vegetation and built-up areas are negative.

In this project, an NDWI threshold of -0.1 was applied after testing multiple thresholds. This value captured water surfaces effectively in the study area.
GIS Project

var water = ndwi.gt(-0.1);
Map.addLayer(water.updateMask(water), {palette:['blue']}, 'Water Mask');
  

Step 4: Water Surface Vectorization

The binary raster water mask was converted into polygons using reduceToVectors. This makes the results more versatile for GIS tasks such as area calculation or overlay with boundaries.

GIS Project

// Convert water mask raster to vector polygons
var vectors_wet = water.addBands(water).reduceToVectors({
  geometry: roi,
  scale: 12,
  geometryType: 'polygon',
  eightConnected: false,
  labelProperty: 'Wet zone',
  reducer: ee.Reducer.mean()
});
Map.addLayer(vectors_wet, {color: 'cyan'}, 'Water Vectors');
  

Conclusion

This workflow demonstrates how NDWI can be applied for water surface mapping in Google Earth Engine. The process involves:

  1. Loading Sentinel-2 data
  2. Computing NDWI
  3. Threshold-based water classification
  4. Vectorization for GIS applications

The resulting vectors can be exported and used in further spatial analysis, environmental monitoring, or hydrological studies.

⬅ Back to Portfolio