GEE Tutorials

Google Earth Engine Tutorial: Calculate Lake Area with Landsat 8

Credit: Youtube Channel “Terra Spatial, Tutorial on calculating lake surface area using Landsat 8 imagery for hydrological monitoring.”

You can see all the tutorials from here: Techgeo Academy.

Google Earth Engine Tutorial: Calculate Lake Area with Landsat 8

Beyond its visual appeal, Google Earth Engine (GEE) is a powerful platform for geospatial analysis, enabling users to process satellite data efficiently. One common task is calculating lake areas using Landsat 8 imagery. This tutorial outlines the steps to achieve this, using GEE’s JavaScript API.

Step 1: Initialize Google Earth Engine

Before starting, ensure you’re logged into your GEE account and have the code editor open. Initialize the API with the following code:

var ee = require('ee');
ee.Authenticate();
ee.Initialize();

Step 2: Load and Filter Landsat 8 Data

Select the Landsat 8 Surface Reflectance Collection (C2) and filter by date, location, and cloud cover. Replace geometry with your preferred area of interest:

var dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
  .filterDate('2020-01-01', '2020-12-31')
  .filter(ee.Filter.lt('CLOUD_COVER', 5))
  .filterBounds(geometry);

Step 3: Select Bands for Water Detection

Use the green and near-infrared (NIR) bands for calculating the Normalized Difference Water Index (NDWI). The formula is: NDWI = (Green - NIR) / (Green + NIR);

var image = dataset.select(['SR_B3', 'SR_B5']); // Green and NIR bands

Step 4: Create a Water Mask

Calculate the NDWI and apply a threshold to identify water pixels. Adjust the threshold value based on your lake’s characteristics:

var ndwi = image.select('SR_B3').subtract(image.select('SR_B5'))
  .divide(image.select('SR_B3').add(image.select('SR_B5')));
var waterMask = ndwi.gt(0.3); // Adjust threshold as needed

Step 4: Apply Cloud Masking

Landsat 8 includes a QA band for cloud masking. Use it to ensure clear skies:

var cloudMask = image.select('QA_PIXEL').bitwiseAnd(1 << 3).eq(0); // 1<<3 corresponds to cloud mask
var finalMask = waterMask.and(cloudMask);

Step 5: Compute Total Lake Area

Use the pixel area function to sum the area of water pixels in your region of interest:

var areaImage = finalMask.multiply(ee.Image.pixelArea()).rename('area');
var areaStats = areaImage.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: geometry,
  scale: 30,
  maxPixels: 1e9
});
print('Total Lake Area (mΒ²):', areaStats.get('area'));

Step 6: Export the Result

Export the lake area to your Google Drive as a CSV file for further analysis:

Export.table.toDrive({
  collection: ee.FeatureCollection([ee.Feature(geometry, areaStats)]),
  description: 'Lake_Area_Export',
  fileFormat: 'CSV'
});

Conclusion

This approach leverages GEE's cloud-based processing to calculate lake area efficiently. Adjust thresholds and parameters based on your specific study area and conditions. For advanced users, consider multi-temporal analysis or machine learning for improved accuracy.

FAQ

  • How do I handle varying water levels in seasonal lakes?

    Use multi-temporal imagery to capture different seasons and calculate average or maximum area over time.

  • Can I use other satellites, like Sentinel-2?

    Yes, but adjust the bands and indices accordingly. For example, Sentinel-2 uses different wavelengths for NDWI.

  • What if my lake has persistent cloud cover?

    Opt for a cloud-free composite or use GEE's qualityMosaic function to prioritize clear scenes.

  • How accurate is the area calculation?

    Accuracy depends on image resolution (30m for Landsat 8) and threshold selection. Validate with field data for higher precision.

  • Can I visualize the water mask in GEE?

    Yes, add the waterMask to the map using Map.addLayer() for visual verification.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *