Tutorial 21 - How to export Earth Engine maps as HTML and images
import ee
import geemap
geemap.show_youtube('h0pz3S6Tvx0')
# geemap.update_package()
Map = geemap.Map()
Map
# Add Earth Engine dataset
dem = ee.Image('USGS/SRTMGL1_003')
landcover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover')
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003')
states = ee.FeatureCollection("TIGER/2018/States")
# Set visualization parameters.
vis_params = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']}
# Add Earth Eninge layers to Map
Map.addLayer(dem, vis_params, 'STRM DEM', True, 0.5)
Map.addLayer(landcover, {}, 'Land cover')
Map.addLayer(landsat7, {'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200}, 'Landsat 7')
Map.addLayer(states, {}, "US States")
You can either click the camera icon on toolbar to export maps or use the following script.
import os
download_dir = os.path.join(os.path.expanduser('~'), 'Downloads')
html_file = os.path.join(download_dir, 'my_map.html')
Map.to_html(outfile=html_file, title='My Map', width='100%', height='880px')
Make sure you click the fullscreen button on the map to maximum the map.
png_file = os.path.join(download_dir, 'my_map.png')
Map.to_image(outfile=png_file, monitor=1)
jpg_file = os.path.join(download_dir, 'my_map.jpg')
Map.to_image(outfile=jpg_file, monitor=1)