Owen
Owen2w ago

Issues with Leafmap widgets

I was having issues with getting Leafmap widgets rendering Choropleth maps to work in Marimo. In this particular example I rendered two Choropleth maps in separate cells which works fine in Jupyter - I converted the notebook to Marimo and initially one of the maps sort of rendered okay - but the moment I tried zooming in the rendered Choropleth polygons got out of sync with the Leaflet map they were overlaying amongst some other text errors before finally the widgets stopped rendering in Marimo altogether. I can provide the complete notebook if that helps. I used both from the same conda-forge Python environment with Python 3.12 on Windows and these package versions: geopandas 1.0.1 pyhd8ed1ab_1 conda-forge jupyterlab 4.2.5 pyhd8ed1ab_0 conda-forge leafmap 0.38.16 pyhd8ed1ab_0 conda-forge marimo 0.9.14 py312h2e8e312_0 conda-forge pandas 2.2.3 py312h72972c8_1 conda-forge
No description
3 Replies
Owen
OwenOP2w ago
Here's a simpler example (taken straight from the Leafmap Choropleth example: https://leafmap.org/notebooks/53_choropleth/?h=choro )
53 choropleth - leafmap
A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
No description
Myles Scolnick
Thanks for sharing - is the simpler example working ok? (In your second comment). I can investigate what is going on.
Owen
OwenOP7d ago
No the second example shows one of the issues... in that example when the widget renders it looks fine initially but when you zoom in and out of the map the polygons get out of sync with the raster leaflet map tiles which you can see in the image (the darker polygon countries aren't overlaying the lighter colored leaflet map raster coastlines properly anymore). A second issue to explore which happened in my initial more complicated example is that if you try and render two leafmap widgets at once in a Marimo notebook it seems to mess up the state when you interact with them... but rendering multiple leafmap widgets at once in Jupyter isn't an issue.