GEE Tutorials

Google Earth Engine Tutorial: Export Glacier Change Timelapse

Credit: Youtube Channel “Terra Spatial, Guide on creating and exporting timelapse videos showing glacier changes from 2014 to 2020.”

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


Google Earth Engine Tutorial: Export Glacier Change Timelapse

Google Earth Engine (GEE) is a powerful platform for analyzing geospatial data. This tutorial will guide you through creating a glacier change timelapse using GEE and exporting it as a video.

Step 1: Access Google Earth Engine

Open the Google Earth Engine Code Editor. Sign in with your Google account to enable access to datasets and export functionalities.

Step 2: Load a Suitable Dataset

Use a dataset that includes multi-temporal satellite imagery, such as Landsat 8 or Sentinel-2. For glaciers, Landsat 8 is a common choice due to its high-resolution and long historical record.


// Load Landsat 8 dataset
var dataset = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR")
  .filterDate('2010-01-01', '2020-12-31')
  .filter(ee.Filter.eq('WRS_PATH', 128))
  .filter(ee.Filter.eq('WRS_ROW', 32));

Step 3: Preprocess the Data

Preprocess the dataset by removing clouds and selecting a specific band for visualizing changes, such as the Near-Infrared (NIR) band.


// Function to mask clouds
function maskClouds(image) {
  var cloudScore = ee.Algorithms.Landsat.simpleCloudScore(image);
  return image.updateMask(cloudScore.select('cloud').lt(20));
}

// Apply cloud masking and select bands
var preprocessed = dataset.map(maskClouds)
  .select(['SR_B5', 'SR_B4', 'SR_B3']);

Step 4: Create the Timelapse

Generate a timelapse by sampling images at regular intervals and creating a composite or individual images.


// Create a list of dates for the timelapse
var dates = preprocessed.distinct('date').map(function(image) {
  return image.date().format('YYYY-MM-dd');
}).getInfo();

// Initialize an empty image collection
var timelapse = ee.ImageCollection([]);

// Add images to the collection
for (var i = 0; i < dates.length; i++) {
  var filtered = preprocessed.filter(ee.Filter.eq('date', dates[i]));
  var image = filtered.first();
  timelapse = timelapse.merge(ee.ImageCollection([image]));
}

Step 5: Export the Timelapse as a Video

Use the ee.Export.video.toDrive method to export the timelapse as a video file.


// Export the timelapse video
Export.video.toDrive({
  collection: timelapse,
  description: 'glacier_timelapse',
  fileNamePrefix: 'glacier_change',
  maxFrames: 200,
  framesPerSecond: 10
});

Step 6: Monitor and Download the Export

After running the code, check the Task panel in the Code Editor for the export status. Wait for the task to complete and download the video from your Google Drive.

FAQ

What if the dataset doesn't show glacier changes?

Ensure your dataset includes time-series data with sufficient temporal coverage. Adjust the date range or select a different satellite collection if necessary.

How to handle clouds in the timelapse?

Use cloud masking techniques like ee.Algorithms.Landsat.simpleCloudScore or other spectral indices. Explore different cloud removal methods based on your data.

Why is the export taking too long?

Large datasets or high-resolution settings increase processing time. Optimize by reducing the time range, resolution, or using lower-resolution proxies.

Can I customize the timelapse colors?

Yes. Modify the select statement to use different bands or apply a visualize parameter for custom color palettes.

How to visualize the timelapse in GEE?

Use the Map.addLayer function with a defined visualization. For example:


Map.addLayer(image, {bands: ['SR_B5', 'SR_B4', 'SR_B3'], min: 0, max: 3000}, 'Glacier Change');


Similar Posts

Leave a Reply

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