Tools for working with the Earth Engine from a Jupyter development environment
NOTICE: This is an experimental project and is not an officially supported Google project. You are welcome to use it, but we do not guarantee stability.
Setup
try:import ee_jupyterprint('ee_jupyter was already installed.')except ModuleNotFoundError:print('ee_jupyter was not found. Installing now...')import os result = os.system('pip -q install earthengine-jupyter')
ee_jupyter was already installed.
How to use
This lib contains a Map class that can be used to display an interactive map.
We can also create an inspector object and associate it with the previously created map.
from ee_jupyter.ipyleaflet import Inspectorinspector1 = Inspector(map_object=map1)inspector1
Typically when you create a inspector object, you will want to display it with the map. The MapWithInpsector object adds a button that toggles the inspector functionality.
The map below shows a Sentinel-2 image covering Paris. Click on the inspector toggle button to open the inspector.
Note that when viewed on GitHub Pages you can manipulate Jupyter widgets independently, but the widgets do not interact with each other. To experience the cross-widget interactivity, open up this notebook in a Jupyter environment.
Displaying a Map Image
If you want to display a static (non-interactive) image, you can do that as well. The embed=True parameter will allow the image to be saved within the notebook.
from IPython.display import Imagevisualization['dimensions'] =400# maximum dimension for the imageurl = img1.getThumbUrl(visualization)Image(url=url, format='png', embed=True)