Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs on interactive mapping within Colab #31

Open
tylere opened this issue Jul 6, 2018 · 1 comment
Open

Add docs on interactive mapping within Colab #31

tylere opened this issue Jul 6, 2018 · 1 comment

Comments

@tylere
Copy link
Contributor

tylere commented Jul 6, 2018

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
@fitoprincipe
Copy link
Member

fitoprincipe commented Jul 8, 2018

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants