08 ee js to ipynb
# !pip install geemap
Install Earth Engine API and geemap¶
Install the Earth Engine Python API and geemap. The geemap Python package is built upon the ipyleaflet and folium packages and implements several methods for interacting with Earth Engine data layers, such as
The following script checks if the geemap package has been installed. If not, it will install geemap, which automatically installs its dependencies, including earthengine-api, folium, and ipyleaflet.
Important note: A key difference between folium and ipyleaflet is that ipyleaflet is built upon ipywidgets and allows bidirectional communication between the front-end and the backend enabling the use of the map to capture user input, while folium is meant for displaying static data only (source). Note that Google Colab currently does not support ipyleaflet (source). Therefore, if you are using geemap with Google Colab, you should use
import geemap.foliumap. If you are using geemap with binder or a local Jupyter notebook server, you can use
import geemap, which provides more functionalities for capturing user input (e.g., mouse-clicking and moving).
# Convert all Earth Engine Python scripts in a folder recursively to Jupyter notebooks. nb_template = get_nb_template() # Get the notebook template from the package folder. py_to_ipynb_dir(js_dir, nb_template) # Execute all Jupyter notebooks in a folder recursively and save the output cells. execute_notebook_dir(in_dir=js_dir)