Describe the bug
At https://python-visualization.github.io/folium/latest/user_guide/ui_elements/layer_control.html, the text says 'add a control to the map to show or hide layers'. But the demo (or local HTML produced by equivalent code on my machine) seems to have incorrect code, which adds the control but has no effect on the TileLayer.
To Reproduce / Expected behavior
Environment (please complete the following information):
- Browser: Chrome or Edge
- Jupyter Notebook or html files? User guide uses Notebook; local env: HTML
- Python version: local env:
sys.version_info(major=3, minor=12, micro=5, releaselevel='final', serial=0)
- folium version: local env: 0.19.4
- branca version: local env 0.8.1
Additional context/Possible solutions
If I change this in my local env:
folium.TileLayer("OpenStreetMap").add_to(m)
folium.TileLayer(show=False).add_to(m)
To:
folium.TileLayer("OpenStreetMap", show=False).add_to(m)
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.
Describe the bug
At https://python-visualization.github.io/folium/latest/user_guide/ui_elements/layer_control.html, the text says 'add a control to the map to show or hide layers'. But the demo (or local HTML produced by equivalent code on my machine) seems to have incorrect code, which adds the control but has no effect on the
TileLayer.To Reproduce / Expected behavior
Environment (please complete the following information):
sys.version_info(major=3, minor=12, micro=5, releaselevel='final', serial=0)Additional context/Possible solutions
If I change this in my local env:
To:
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 aFeatureGroupwith aLayerControl]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.