geemap is a Python package for interactive mapping with Google Earth Engine (GEE), which is a cloud computing platform with a multi-petabyte catalog of satellite imagery and geospatial datasets. During the past few years, GEE has become very popular in the geospatial community and it has empowered numerous environmental applications at local, regional, and global scales. GEE provides both JavaScript and Python APIs for making computational requests to the Earth Engine servers. Compared with the comprehensive documentation and interactive IDE (i.e., GEE JavaScript Code Editor) of the GEE JavaScript API, the GEE Python API lacks good documentation and functionality for visualizing results interactively. The geemap Python package is created to fill this gap. It is built upon ipyleaflet and ipywidgets, enabling GEE users to analyze and visualize Earth Engine datasets interactively with Jupyter notebooks.
geemap is intended for students and researchers, who would like to utilize the Python ecosystem of diverse libraries and tools to explore Google Earth Engine. It is also designed for existing GEE users who would like to transition from the GEE JavaScript API to Python API. The automated JavaScript-to-Python conversion module of the geemap package can greatly reduce the time needed to convert existing GEE JavaScripts to Python scripts and Jupyter notebooks.
For video tutorials and notebook examples, please visit https://github.com/giswqs/geemap/tree/master/examples. For complete documentation on geemap modules and methods, please visit https://geemap.readthedocs.io/en/latest/source/geemap.html.
Features
Below is a partial list of features available for the geemap package. Please check the examples page for notebook examples, GIF animations, and video tutorials.
Automated conversion from Earth Engine JavaScripts to Python scripts and Jupyter notebooks.
Displaying Earth Engine data layers for interactive mapping.
Supporting Earth Engine JavaScript API-styled functions in Python, such as Map.addLayer(), Map.setCenter(), Map.centerObject(), Map.setOptions().
Creating split-panel maps with Earth Engine data.
Retrieving Earth Engine data interactively using the Inspector Tool.
Interactive plotting of Earth Engine data by simply clicking on the map.
Converting data format between GeoJSON and Earth Engine.
Using drawing tools to interact with Earth Engine data.
Using shapefiles with Earth Engine without having to upload data to one's GEE account.
Exporting Earth Engine FeatureCollection to other formats (i.e., shp, csv, json, kml, kmz) using only one line of code.
Exporting Earth Engine Image and ImageCollection as GeoTIFF.
Extracting pixels from an Earth Engine Image into a 3D numpy array.
Calculating zonal statistics by group (e.g., calculating land over composition of each state/country).
Adding a customized legend for Earth Engine data.
Converting Earth Engine JavaScripts to Python code directly within Jupyter notebook.
Adding animated text to GIF images generated from Earth Engine data.
Adding colorbar and images to GIF animations generated from Earth Engine data.
Creating Landsat timelapse animations with animated text using Earth Engine.
Searching places and datasets from Earth Engine Data Catalog.
Using timeseries inspector to visualize landscape changes over time.
Exporting Earth Engine maps as HTML files and PNG images.
Searching Earth Engine API documentation within Jupyter notebooks.
Installation
To use geemap, you must first sign up for a Google Earth Engine account. geemap is available on PyPI. To install geemap, run this command in your terminal:
pip install geemap
geemap is also available on conda-forge. If you have Anaconda or Miniconda installed on your computer, you can create a conda Python environment to install geemap:
conda create -n gee python
conda activate gee
conda install -c conda-forge geemap
If you have installed geemap before and want to upgrade to the latest version, you can run the following command in your terminal:
pip install -U geemap
If you use conda, you can update geemap to the latest version by running the following command in your terminal:
conda update -c conda-forge geemap
Usage
Important note: A key difference between ipyleaflet and folium 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.eefolium. 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).
Youtube tutorial videos
GitHub page of geemap
Documentation
While working on a small project I found this. This is a quite new library, some features shown in the tutorial may not work as intended but overall a very good package. The tools make the code much cleaner and readable. Searching EE docs from notebook is not yet implemented. Check out the youtube channel, it's great.