Tools for working with the Earth Engine from a Jupyter development environment
Project description
earthengine-jupyter
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_jupyter
print('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')
Make sure that the earthengine-jupyter package is installed...
How to use
This lib contains a
Map
class that can be used to display an interactive map.
import ee
from ee_jupyter.core import authenticate_if_needed
from ee_jupyter.ipyleaflet import Map
authenticate_if_needed()
✓ Authentication credentials were found.
# Intialize the Earth Engine client library.
ee.Initialize()
map1 = Map(center=(37.5924, -122.09), zoom=8)
map1
Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zo…
Define an Earth Engine image layer, and add it to the interactive map.
img1 = ee.Image("LANDSAT/LC09/C02/T1_L2/LC09_044034_20220127")
visualization = {
'bands': ['SR_B4', 'SR_B3', 'SR_B2'],
'min': 0.2 / 0.0000275,
'max': 0.4 / 0.0000275,
}
map1.addLayer(eeObject=img1, visParams=visualization, name='Landsat scene')
We can also create an inspector object and associate it with the previously created map.
from ee_jupyter.ipyleaflet import Inspector
inspector1 = Inspector(map_object=map1)
inspector1
Inspector(layout=Layout(border_bottom='solid', border_left='solid', border_right='solid', border_top='solid', …
Typically when you create a inspector object, you will want to display it near the map.
from ipywidgets import HBox
display(HBox([map1, inspector1]))
HBox(children=(Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom…
Tip With Caption
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 Image
visualization['dimensions'] = 400 # maximum dimension for the image
url = img1.getThumbUrl(visualization)
Image(url=url, format='png', embed=True)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file earthengine-jupyter-0.0.5.tar.gz
.
File metadata
- Download URL: earthengine-jupyter-0.0.5.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a583bc3f76793ef405a2f5701651f1c03bbc4a35cd924ef73ceaa36a7c78d0 |
|
MD5 | 8beaf63bda82a241fa1a9ad74572abaa |
|
BLAKE2b-256 | 87788d840244e1c9b5ba1eccb93f5efb9fa745664c2a4673cc42bf7d907903a0 |
File details
Details for the file earthengine_jupyter-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: earthengine_jupyter-0.0.5-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3edb0258587b8598a492803240a09d17a666a2236dec8e4a313f756f76a809de |
|
MD5 | 1b580e720d1960941e5475b266c1e09a |
|
BLAKE2b-256 | b31375a126281f395c8808d28ced0663bf586c4dbf285f5a4ae504ce27e6b574 |