1

I have created an animated thumbnail of an image collection using the following piece of code:

// Create a video thumbnail and add it to the map.
var thumb = ui.Thumbnail({
  // Specifying a collection for "image" animates the sequence of images.
  image: collection,
  params: args,
  style: {
    position: 'bottom-right',
    width: '320px'
  }});
Map.add(thumb);

How can export the thumbnail to Google Drive as a GIF or other similar format?

1
  • 1
    I believe you cannot do that. Apr 20, 2020 at 9:05

1 Answer 1

4

You can do this from Google Colab using the Earth Engine Python API.

Here is a demo notebook.

###################################################################################
# Setup Earth Engine.
###################################################################################

import ee
ee.Authenticate()
ee.Initialize()

###################################################################################
# Get the animation URL.
###################################################################################

# Define an area of interest geometry with a global non-polar extent.
aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], None,
  False)

# Import hourly predicted temperature image collection for northern winter
# solstice. Note that predictions extend for 384 hours; limit the collection
# to the first 24 hours.
temp_col = (ee.ImageCollection('NOAA/GFS0P25')
  .filterDate('2018-12-22', '2018-12-23')
  .limit(24)
  .select('temperature_2m_above_ground'))

# Define arguments for animation function parameters.
video_args = {
  'dimensions': 768,
  'region': aoi,
  'framesPerSecond': 7,
  'crs': 'EPSG:3857',
  'min': -40.0,
  'max': 35.0,
  'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
}

# Get URL that will produce the animation when accessed.
gif_url = temp_col.getVideoThumbURL(video_args)

###################################################################################
# Save the animation to Google Drive.
###################################################################################

# Mount Google Drive to the Colab VM.
from google.colab import drive
drive.mount('gdrive')

# Download animation to Google Drive.
import urllib.request
gif_name = 'gdrive/My Drive/ee_collection_animation.gif' # <-- Need to define
urllib.request.urlretrieve(gif_url, gif_name)

You can also right click on the animation that appears in the ui.Thumbnail() element and select a download option (GIF format).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.