gitmyhub

leafmap

Python ★ 3.7k updated 1d ago

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment

A Python package for creating interactive maps and running geographic analysis in Jupyter notebooks with just a few lines of code, no Google Earth Engine account needed.

PythonJupyterfoliumipyleafletWhiteboxToolssetup: easycomplexity 2/5

Leafmap is a Python package that lets you create interactive maps and analyze geographic data without writing much code. It runs inside Jupyter notebooks, which are browser-based environments commonly used for data science work in tools like Google Colab and JupyterLab. The main appeal is that you can put a map on screen and load geographic files onto it in a single line of Python.

The package fills a gap for people who want to work with geographic data but do not have access to Google Earth Engine, a powerful cloud platform that requires an approved account. Leafmap is free and open source with no account required. It was originally spun off from a related package called geemap, which was built specifically for Google Earth Engine users.

Under the hood, Leafmap combines several other open-source libraries. The map display is handled by folium and ipyleaflet, which create the interactive map you see in the browser. Geographic analysis, including things like terrain analysis, watershed modeling, and LiDAR data processing, is handled by a library called WhiteboxTools, which includes over 500 analysis tools. Leafmap wraps all of this with an optional graphical user interface so you can load data files and run analyses by clicking buttons rather than writing code.

Some key features described in the README: switching between multiple map display backends (ipyleaflet, folium, kepler.gl, pydeck, and bokeh), loading vector and raster files from local disk or from cloud storage, and running geospatial analysis tools through a visual panel. The package is also supported in the marimo notebook environment.

Leafmap is licensed under the MIT license and has tutorials available on YouTube as well as a dedicated documentation site.

Where it fits