Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leafmap map does not rerender after code changes #3088

Open
diehl opened this issue Dec 7, 2024 · 6 comments
Open

Leafmap map does not rerender after code changes #3088

diehl opened this issue Dec 7, 2024 · 6 comments
Labels
bug Something isn't working upstream

Comments

@diehl
Copy link

diehl commented Dec 7, 2024

Describe the bug

When writing Leafmap code to design maps in Marimo, I'm not able to get an updated version of the map rendered in the notebook without reloading the entire notebook. After making a code change, I rerun the cell and no update occurs. Needing to reload the entire notebook obviously makes the map development process even slower than a Jupyter notebook. I'd love to see this fixed as being able to run the notebook as an app straightaway makes the process of sharing maps extremely easy!

A simple code snippet that helps highlight the issue is the following. If you make changes to the viz height and rerun the cell, the resulting map does not change.

m = leafmap.Map(
    center=(-98.5795,39.8283),  # Center of the US
    zoom=3,                     # Initial zoom level
    height='500px'
)
m

Running this code with leafmap==0.39.2.

Environment

{
"marimo": "0.9.31",
"OS": "Darwin",
"OS Version": "23.6.0",
"Processor": "i386",
"Python Version": "3.11.10",
"Binaries": {
"Browser": "131.0.6778.109",
"Node": "v23.2.0"
},
"Dependencies": {
"click": "8.1.7",
"docutils": "0.21.2",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.6",
"narwhals": "1.13.5",
"packaging": "24.2",
"psutil": "6.1.0",
"pygments": "2.18.0",
"pymdown-extensions": "10.12",
"pyyaml": "6.0.2",
"ruff": "0.7.4",
"starlette": "0.41.2",
"tomlkit": "0.13.2",
"typing-extensions": "4.12.2",
"uvicorn": "0.32.0",
"websockets": "12.0"
},
"Optional Dependencies": {
"anywidget": "0.9.13",
"duckdb": "1.1.3",
"pandas": "2.2.3",
"pyarrow": "18.0.0"
}
}

Code to reproduce

import leafmap

# Making updates to the viz height and rerunning the cell leads to no update in the map
m = leafmap.Map(center=(-98.5795,39.8283), zoom=3, height='500px')
m
@diehl diehl added the bug Something isn't working label Dec 7, 2024
@mscolnick
Copy link
Contributor

mscolnick commented Dec 12, 2024

@diehl updates work for me, but i do see height not being respected. unsure but might be the internals of leafmap?

Image

@diehl
Copy link
Author

diehl commented Dec 12, 2024

@mscolnick Roger that. FYI I noticed similarly when I was adding a logo to the map that my changes to the logo size were also not updating.

@mscolnick
Copy link
Contributor

If you inspect your maps .to_html(), do you see the changes in there. If not, then it might be in the map, if you do see the changes, then marimo is probably responsible for its staleness.

This map is also the folium map (instead of the jupyter leaflet), so it may have a slight difference in features.

@diehl
Copy link
Author

diehl commented Dec 12, 2024

@mscolnick I just realized I left out two key details! I'm using the MapLibre backend. So when installing the package, I am usingpip install "leafmap[maplibre]". And the import is import leafmap.maplibregl as leafmap. Apologies for these omissions!

@mscolnick
Copy link
Contributor

hey @diehl - happy to look at this. can you provide a full minimal repo? best would be a notebook run with marimo new --sandbox so the packages are also in the notebook

@diehl
Copy link
Author

diehl commented Feb 26, 2025

thank you @mscolnick! your message is so timely as I was thinking about circling back on this issue. being able to design maps interactively with Leafmap would be such a huge win! happy to help however I can make this happen. I'll circle back on this when I get some time to put this together! more soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

2 participants