Home

Awesome

Welcome to leafmap

image image image image image Conda Recipe image Conda Downloads image image pre-commit.ci status image image status

logo

A Python package for geospatial analysis and interactive mapping in a Jupyter environment.

Join our Discord server 👇

Introduction

Leafmap is a Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment. It is a spin-off project of the geemap Python package, which was designed specifically to work with Google Earth Engine (GEE). However, not everyone in the geospatial community has access to the GEE cloud computing platform. Leafmap is designed to fill this gap for non-GEE users. It is a free and open-source Python package that enables users to analyze and visualize geospatial data with minimal coding in a Jupyter environment, such as Google Colab, Jupyter Notebook, JupyterLab, and marimo. Leafmap is built upon several open-source packages, such as folium and ipyleaflet (for creating interactive maps), WhiteboxTools and whiteboxgui (for analyzing geospatial data), and ipywidgets (for designing interactive graphical user interface [GUI]). Leafmap has a toolset with various interactive tools that allow users to load vector and raster data onto the map without coding. In addition, users can use the powerful analytical backend (i.e., WhiteboxTools) to perform geospatial analysis directly within the leafmap user interface without writing a single line of code. The WhiteboxTools library currently contains 500+ tools for advanced geospatial analysis, such as GIS Analysis, Geomorphometric Analysis, Hydrological Analysis, LiDAR Data Analysis, Mathematical and Statistical Analysis, and Stream Network Analysis.

Acknowledgments

This project is supported by Amazon Web Services (AWS).

Statement of Need

There is a plethora of Python packages for geospatial analysis, such as geopandas for vector data analysis and xarray for raster data analysis. As listed at pyviz.org, there are also many options for plotting data on a map in Python, ranging from libraries focused specifically on maps like ipyleaflet and folium to general-purpose plotting tools that also support geospatial data types, such as hvPlot, bokeh, and plotly. While these tools provide powerful capabilities, displaying geospatial data from different file formats on an interactive map and performing basic analyses can be challenging, especially for users with limited coding skills. Furthermore, many tools lack bi-directional communication between the frontend (browser) and the backend (Python), limiting their interactivity and usability for exploring map data.

Leafmap addresses these challenges by leveraging the bidirectional communication provided by ipyleaflet, enabling users to load and visualize geospatial datasets with just one line of code. Leafmap also provides an interactive graphical user interface (GUI) for loading geospatial datasets without any coding. It is designed for anyone who wants to analyze and visualize geospatial data interactively in a Jupyter environment, making it particularly accessible for novice users with limited programming skills. Advanced programmers can also benefit from leafmap for geospatial data analysis and building interactive web applications.

Usage

Launch the interactive notebook tutorial for the leafmap Python package with Google Colab, Binder, or Amazon Sagemaker Studio Lab now:

image image Open In Studio Lab

Check out this excellent article on Medium - Leafmap a new Python Package for Geospatial data science

To learn more about leafmap, check out the leafmap documentation website - https://leafmap.org

Key Features

Leafmap offers a wide range of features and capabilities that empower geospatial data scientists, researchers, and developers to unlock the potential of their data. Some of the key features include:

These features and capabilities make leafmap a powerful tool for geospatial data exploration, analysis, and visualization. Whether you are a beginner or an experienced geospatial data scientist, leafmap provides an accessible and efficient way to work with geospatial data in Python.

Citations

If you find leafmap useful in your research, please consider citing the following paper to support my work. Thank you for your support.

Demo

YouTube Channel

I have created a YouTube Channel for sharing geospatial tutorials. You can subscribe to my channel for regular updates. Check out the following videos for 3D mapping with MapLibre and Leafmap.

MapLibre tutorials