geemap Documentation

repository·master·Indexed 26 days ago

https://github.com/gee-community/geemap

A Python package for interactive geospatial analysis and visualization with Google Earth Engine (GEE). geemap enhances the GEE Python API by providing interactive mapping tools within Jupyter environments, including JavaScript-to-Python conversion, data interoperability between GeoJSON and Earth Engine, and advanced visualization tools for creating animated GIFs and Landsat timelapses.

Tokens
85.6K
Snippets
305
Records
589
Agent score
87%

What's inside geemap

  1. Overview of geemap features

    master

    geemap is a Python package designed for interactive geospatial analysis and visualization with Google Earth Engine (GEE). It bridges the gap between the GEE JavaScript API and the Python ecosystem by providing interactive mapping capabilities within Jupyter-based environments.

    Key capabilities include:

    • Interactive Mapping: Display GEE data layers, use split-panel maps, and use an Inspector Tool to retrieve data by clicking on the map.
    • JavaScript to Python Conversion: Convert existing GEE JavaScript code to Python scripts or Jupyter notebooks using the built-in conversion module.
    • Data Interoperability: Convert between GeoJSON and Earth Engine, use local shapefiles without uploading to GEE, and export Earth Engine data to formats like shp, csv, json, kml, kmz, or GeoTIFF.
    • Advanced Visualization: Create animated GIFs with text/colorbars, generate Landsat timelapses, and export maps as HTML or PNG.
    • Analysis Tools: Perform image classification, accuracy assessment, calculate zonal statistics, and extract pixels into 3D numpy arrays.
  2. Overview of geemap modules

    master

    The geemap package is organized into several specialized modules:

    • geemap: The main module for interactive mapping using Google Earth Engine, ipyleaflet, and ipywidgets.
    • foliumap: A module for interactive mapping with Earth Engine and folium, specifically designed for Google Colab.
    • conversion: Utilities for automatically converting Google Earth Engine JavaScript code to Python scripts and Jupyter notebooks.
    • basemaps: A module for adding various XYZ and WMS tiled basemaps.
    • legends: A module for adding customized legends to interactive maps.
  3. Upgrade geemap

    master

    To update geemap to the latest version, use the command corresponding to your installation method:

    Using pip:

    pip install -U geemap

    Using conda:

    conda update -c conda-forge geemap

    Using Jupyter Notebook (Development version): If you want to install the development version from GitHub directly within a Jupyter notebook without using Git, run:

    import geemap
    geemap.update_package()
  4. Use geemap for interactive mapping in Jupyter notebooks

    master

    To access the full interactive mapping functionality of geemap (which uses ipyleaflet and ipywidgets for bidirectional communication), run geemap on a local computer or a secured server with Jupyter notebook installed.

    import geemap
  5. Use geemap in regions with blocked Google Services

    master

    In regions where Google Services are blocked (e.g., China), you must use a VPN to avoid connection timeouts. You can configure geemap to use your local proxy by calling geemap.set_proxy(port=your-port-number).

    import geemap
    geemap.set_proxy(port=your-port-number)
    Map = geemap.Map()
    Map
  6. Create a Landsat timelapse

    master

    You can create a Landsat timelapse using the Map.add_landsat_ts_gif method. This method allows you to generate a GIF of Landsat imagery over a specified time range and region of interest (ROI).

    Steps to create a timelapse using the interactive widget approach:

    1. Pan and zoom to your area of interest on the map.
    2. Use the drawing tool to draw a rectangle (this becomes the Map.user_roi).
    3. Configure parameters such as start/end year, month, RGB band combinations, and normalized difference indices.
    4. Click the Create timelapse button.
    5. Once generated, use the provided hyperlink to download the GIF.

    Key Parameters for add_landsat_ts_gif:

    • roi: The area of interest (e.g., Map.user_roi).
    • label: The title/label for the timelapse.
    • start_year / end_year: The temporal range.
    • start_date / end_date: Specific month/day strings (e.g., "05-01").
    • bands: A list of bands for the RGB combination (e.g., ['NIR', 'Red', 'Green']).
    • apply_fmask: Boolean to remove clouds, shadows, and snow.
    • nd_bands: A list of two bands used to calculate a Normalized Difference index.
    • nd_threshold: Threshold for the index calculation.
    • nd_palette: A list of colors for the index palette (e.g., ["black", "blue"]).
    • download: Set to True to enable a download link.
  7. Cite geemap in publications

    master

    If you use geemap in your research or publications, please cite the following paper:

    Wu, Q., (2020). geemap: A Python package for interactive mapping with Google Earth Engine. The Journal of Open Source Software, 5(51), 2305. https://doi.org/10.21105/joss.02305

    BibTeX:

    @article{wu2020geemap,
        title={geemap: A Python package for interactive mapping with Google Earth Engine},
        author={Wu, Qiusheng},
        journal={Journal of Open Source Software},
        volume={5},
        number={51},
        pages={2305},
        year={2020}
    }