Uncomment the following line to install geemap if needed.
# !pip install geemap
import geemap
import os
geemap.show_youtube('fDnDVuM_Ke4')
# geemap.update_package()
You can download this GIF example from here. You can also create GIF images from Earth Engine data using this amazing LT-GEE Time Series Animator, which was created by Justin Braaten.
in_gif = os.path.abspath('../data/animation.gif')
out_dir = os.path.join(os.path.expanduser('~'), 'Downloads')
out_gif = os.path.join(out_dir, 'output.gif')
if not os.path.exists(out_dir):
os.makedirs(out_dir)
geemap.show_image(in_gif)
geemap.add_text_to_gif(
in_gif,
out_gif,
xy=('5%', '5%'),
text_sequence=1984,
font_size=30,
font_color='#0000ff',
duration=100,
)
geemap.show_image(out_gif)
geemap.add_text_to_gif(
out_gif, out_gif, xy=('30%', '85%'), text_sequence="Las Vegas", font_color='black'
)
geemap.show_image(out_gif)
geemap.system_fonts()
geemap.add_text_to_gif(
in_gif,
out_gif,
xy=('5%', '5%'),
text_sequence=1984,
font_size=30,
font_color='#0000ff',
duration=100,
)
geemap.add_text_to_gif(
out_gif,
out_gif,
xy=('30%', '85%'),
text_sequence="Las Vegas",
font_type="timesbd.ttf",
font_size=30,
font_color='black',
)
geemap.show_image(out_gif)
import ee
import geemap
ee.Initialize()
# 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.
tempCol = (
ee.ImageCollection('NOAA/GFS0P25')
.filterDate('2018-12-22', '2018-12-23')
.limit(24)
.select('temperature_2m_above_ground')
)
# Define arguments for animation function parameters.
videoArgs = {
'dimensions': 768,
'region': aoi,
'framesPerSecond': 10,
'crs': 'EPSG:3857',
'min': -40.0,
'max': 35.0,
'palette': ['blue', 'purple', 'cyan', 'green', 'yellow', 'red'],
}
saved_gif = os.path.join(os.path.expanduser('~'), 'Downloads/temperature.gif')
geemap.download_ee_video(tempCol, videoArgs, saved_gif)
geemap.show_image(saved_gif)
text = [str(n).zfill(2) + ":00" for n in range(0, 24)]
print(text)
out_gif = os.path.join(os.path.expanduser('~'), 'Downloads/output2.gif')
geemap.add_text_to_gif(
saved_gif,
out_gif,
xy=('3%', '5%'),
text_sequence=text,
font_size=30,
font_color='#ffffff',
)
geemap.add_text_to_gif(
out_gif,
out_gif,
xy=('32%', '92%'),
text_sequence='NOAA GFS Hourly Temperature',
font_color='white',
)
geemap.show_image(out_gif)