You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
User guide LayerControl example (controlling TileLayer) doesn't work #2093
This partially fixes the problem - the OpenStreet map tiles are not initially visible, and the 'openstreetmap' control can be selected to make them visible, however the control cannot be deselected and so the tiles cannot be hidden again.
[Edit: I have only encountered this with a TileLayer - no issues controlling a FeatureGroup with a LayerControl]
folium is maintained by volunteers. Can you help making a fix for this issue?
Maybe, depending on complex the docs setup is; need to understand root issue first.
changed the title [-]User guide `LayerControl` example doesn't work[/-][+]User guide `LayerControl` example (controlling `TileLayer`) doesn't work[/+]on Feb 18, 2025
You are right. The documentation about Layers is confusing. I also ran into this when I first started out with Folium. Let me have a look at your PR over the weekend. I have not have had time to take a detailed look at the other issues you created, but I will block some time this weekend.
On looking at this specific issue again, what I've written above doesn't make logical sense - I think I may be getting inconsistent/unexpected/buggy behaviour in my environment.
I will try to put a set of test cases together so it's clear to me how things actually behave, and will make the PR draft.
[Edit: resolved, simple copy/paste error on my part]
Activity
[-]User guide `LayerControl` example doesn't work[/-][+]User guide `LayerControl` example (controlling `TileLayer`) doesn't work[/+]elliot-100 commentedon Mar 11, 2025
From experimentation (and reading the rest of the page...) the problem is that
TileLayers are base layers by default, so mutually exclusive.So the example:
Should be [corrected]:
So it does what it describes "add a control to the map to show or hide layers".
I don't think the
show=Falseshould be in there, as the 3rd example 'Show manually' covers that behaviour.elliot-100 commentedon Mar 11, 2025
Raised PR #2105.
hansthen commentedon Mar 13, 2025
You are right. The documentation about Layers is confusing. I also ran into this when I first started out with Folium. Let me have a look at your PR over the weekend. I have not have had time to take a detailed look at the other issues you created, but I will block some time this weekend.
elliot-100 commentedon Mar 13, 2025
On looking at this specific issue again, what I've written above doesn't make logical sense - I think I may be getting inconsistent/unexpected/buggy behaviour in my environment.
I will try to put a set of test cases together so it's clear to me how things actually behave, and will make the PR draft.
[Edit: resolved, simple copy/paste error on my part]