Leafmap
raw JSON → 0.61.1 verified Mon Apr 27 auth: no python
A Python package for geospatial analysis and interactive mapping in a Jupyter environment. Version 0.61.1, released monthly.
pip install leafmap Common errors
error ModuleNotFoundError: No module named 'leafmap.leafmap' ↓
cause Removed in v0.30.0; the correct import is `from leafmap import Map`.
fix
Use
from leafmap import Map instead of from leafmap.leafmap import Map. error ValueError: The `max_image_size` must be a positive integer. ↓
cause `add_raster()` expected a positive integer but received a float or non-positive integer.
fix
Pass an integer:
m.add_raster('file.tif', max_image_size=1000) Warnings
deprecated The `leafmap.leafmap` module is deprecated. Use `from leafmap import Map` instead of `from leafmap.leafmap import Map`. ↓
fix Use `from leafmap import Map`
gotcha In Google Colab, ipyvue must be pinned to <1.12.0 to avoid maplibre load failures. Leafmap now pins it automatically, but if you install other packages that upgrade ipyvue, you may break the map. ↓
fix Reinstall leafmap or downgrade ipyvue: `pip install ipyvue<1.12.0`
breaking The `leafmap.common` module was temporarily removed in v0.59.0 and restored in v0.60.0. If you used `from leafmap.common import *`, ensure you are on v0.60.0+. ↓
fix Upgrade leafmap to >=0.60.0
gotcha When using `Map.add_raster()`, large files may cause memory issues. Use `max_image_size` parameter or reproject to COG first. ↓
fix Use `m.add_raster('file.tif', max_image_size=1000)`
Imports
- Map wrong
import leafmap m = leafmap.Map()correctfrom leafmap import Map
Quickstart
from leafmap import Map
m = Map()
m.add_basemap('HYBRID')
m