python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.94k stars 2.23k forks source link

Passing base layers to GroupedLayerControl plugin #1876

Open berrfred opened 9 months ago

berrfred commented 9 months ago

My goal is to display in a single control layer component both base layers and grouped overlays.

As far as I understand today we can either display base layers with non grouped overlays or display grouped overlays with the GroupedLayerControl plugin but then a null is used for base layers ...

Why not allowing to also pass a base layers array to the GroupedLayerControl ? Then setting the regular control to False I should be ok.

berrfred commented 9 months ago

Below what I would like to achieve.

image

hansthen commented 7 months ago

@berrfred That would be a useful addition. The underlying leaflet control supports this, so it should be possible to add. I am not sure when this will be picked up though (unless you are willing to make PR yourself).

In the meantime, there is another plugin (treelayercontrol.TreeLayerControl) that already supports adding base Layers. This control is scheduled to be released with release 17, but you can pip install it from source code. Can you have a look to see if this would help for your use case?