Lab 19 - Making GIFs and Videos of Environmental Change

Objective: Create animated GIFs and filmstrips to visualize temporal changes in satellite imagery.

What You'll Learn

  • Filter ImageCollections by date and location
  • Create temporal composites from image series
  • Sort images chronologically for animation
  • Apply visualization parameters to image collections
  • Generate animated GIFs and filmstrip thumbnails

Why This Matters

Animations are powerful tools for communication:

  • Show change: Animations reveal patterns invisible in single images
  • Engage audiences: Motion captures attention better than static images
  • Tell stories: Seasonal cycles, disasters, and trends become visible
  • Share easily: GIFs work in presentations, social media, and reports

Before You Start

  • Prerequisites: Understand ImageCollections and visualization parameters.
  • Estimated time: 60 minutes
  • Materials: Earth Engine account and a region of interest in mind.

Key Terms

Animation
A sequence of images displayed rapidly to create the illusion of motion.
Filmstrip
A single image showing all frames of an animation side-by-side for comparison.
Temporal Composite
An image created by combining multiple images from different times (e.g., monthly median).
Frame Rate (FPS)
Frames per second - how many images are shown each second in an animation.

Animation Workflow

Step Purpose Method
1. Filter Select images by date/location filterDate(), filterBounds()
2. Composite Reduce cloud/noise effects reduce(), median()
3. Sort Ensure chronological order sort('system:time_start')
4. Visualize Apply color palette map() + visualize()
5. Export Generate GIF/filmstrip getVideoThumbURL()

Step 1: Filter the ImageCollection

Start by importing MODIS NDVI data and filtering by date and region:

// Import MODIS NDVI dataset
var col = ee.ImageCollection('MODIS/006/MOD13A2').select('NDVI');

// Define date range and region of interest (Africa continent)
var startDate = '2018-01-01';
var endDate = '2018-12-31';
var regionOfInterest = ee.Geometry.Rectangle([
    -18.698368046353494, 38.1446395611524, 
    52.229366328646506, -36.16300755581617
]);

// Filter the ImageCollection
var filtered = col.filterDate(startDate, endDate)
                  .filterBounds(regionOfInterest);

Step 2: Create Composites (Optional)

If you want to reduce the number of frames, create temporal composites:

// Create a single composite using median reducer
var composite = filtered.reduce(ee.Reducer.median());

When to composite: Use compositing when you have many images per time period and want to reduce noise. Skip this step if you want each original image as a frame.

Step 3: Sort Chronologically

Ensure images appear in the correct time order:

// Sort the collection by acquisition time
var sorted = filtered.sort('system:time_start');

Step 4: Apply Visualization

Define a color palette and apply it to each image:

// Define visualization parameters for NDVI
var visParams = {
  min: 0.0,
  max: 9000.0,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
  ]
};

// Apply visualization to each image in the collection
var visualized = sorted.map(function(image) {
  return image.visualize(visParams);
});

Step 5: Generate the Animation

Create the animated GIF and filmstrip:

// Define output parameters
var outputParams = {
  'region': regionOfInterest,
  'dimensions': 600,
  'crs': 'EPSG:3857',
  'framesPerSecond': 10
};

// Generate animation URL
var animationUrl = visualized.getVideoThumbURL(outputParams);
print("Animation URL:", animationUrl);

// Generate filmstrip URL
var filmstripUrl = visualized.getFilmstripThumbURL(outputParams);
print("Filmstrip URL:", filmstripUrl);

// Render animation directly in the console
print("Animation:", ui.Thumbnail(visualized, outputParams));

Expected Result

Your animation should show seasonal vegetation changes across Africa throughout 2018:

NDVI animation of Africa

Challenge: Customize Your Animation

Now that you've created the example, try these modifications:

  • Different location: Zoom into a specific country or region
  • Different dataset: Try Landsat true color or land surface temperature
  • Different time period: Show change over multiple years
  • Adjust frame rate: Slow down or speed up the animation

For more ideas, see: GEE ImageCollection Visualization Guide

Check Your Understanding

  1. Why is it important to sort the ImageCollection before creating an animation?
  2. What's the difference between getVideoThumbURL and getFilmstripThumbURL?
  3. How does the framesPerSecond parameter affect your animation?
  4. What visual pattern would you expect to see in an annual NDVI animation for Africa?

Troubleshooting

Problem: Animation is too fast/slow

Solution: Adjust the framesPerSecond parameter. Lower values (2-5) are slower; higher values (15-30) are faster.

Problem: "User memory limit exceeded" error

Solution: Reduce the dimensions parameter, use a smaller region, or filter to fewer images.

Problem: Animation shows only one frame

Solution: Check that your filter returns multiple images. Print the collection size using print(filtered.size()).

Problem: Colors don't look right

Solution: Adjust the min/max values in visParams to match your data's actual value range.

Pro Tips

  • Add text annotations: Use image.annotate() to add dates to each frame
  • Create monthly composites: Group images by month for smoother animations
  • Export high quality: Use Export.video.toDrive() for full resolution videos
  • Optimal frame count: 12-36 frames usually work best for seasonal animations

📋 Lab Submission

Subject: Lab 19 - Making GIFs and Videos - [Your Name]

Submit:

A shareable URL to your GEE script that includes:

  1. The example Africa NDVI animation
  2. Your customized animation (different location, dataset, or time period)
  3. Comments explaining your customization choices