ee-jupyter-contrib
ee-jupyter-contrib copied to clipboard
Add docs on interactive mapping within Colab
Example of using eeconvert & folium:
!pip install -U -q earthengine-api
!pip install -U -q eeconvert
%%bash
earthengine authenticate --quiet
%%bash
earthengine authenticate --authorization-code=PLACE_AUTH_CODE_HERE
import ee
from eeconvert import eeImageToFoliumLayer as ee_plot
import folium
try:
ee.Initialize()
print('The Earth Engine package initialized successfully!')
except ee.EEException as e:
print('The Earth Engine package failed to initialize!')
except:
print("Unexpected error:", sys.exc_info()[0])
raise
srtm = ee.Image('USGS/SRTMGL1_003')
srtm = srtm.visualize(min=300, max=2500)
m = folium.Map(location=[12.5,77], zoom_start=8, tiles=None, width=800, height=600)
ee_plot(srtm, 'SRTM').add_to(m)
folium.LayerControl().add_to(m)
m
This would be using geetools (Tested in Colab)
# INSTALL PACKAGES
!pip install -U -q earthengine-api
!pip install -U -q geetools
!pip install -U -q folium
# AUTHENTICATE
%%bash
earthengine authenticate --quiet
%%bash
earthengine authenticate --authorization-code=PLACE_AUTH_CODE_HERE
# IMPORT MODULES
import ee
ee.Initialize()
from geetools import maptool
# EE CODE
p = ee.Geometry.Point(-72,-42)
srtm = ee.Image('USGS/SRTMGL1_003')
# MAP
Map = maptool.Map(width='50%')
Map.addLayer(srtm, {'min':500, 'max':2000}, 'STRM')
Map.addMarker(p, data=srtm)
Map.centerObject(p, zoom=10)
Map.show()