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
I have a polygons which are part of sub groups (FeatureGroupSubGroup) and these sub groups are part of Groups (FeatureGroup).
What i need is "listing" it like on this image:
I need that my groups (shown as "Big group in image) will have sup groups shown like here and that i can either turn of / off whole group or turn off / on each sup group separatly even big groups are off for example. Currently, i have no idea how to do it.
Here is my code :
chranene_oblasti=folium.FeatureGroup("Chránené oblasti",control=False)
druhy_stupen=folium.plugins.FeatureGroupSubGroup(chranene_oblasti,name="II. stupeň ochrany")
treti_stupen=folium.plugins.FeatureGroupSubGroup(chranene_oblasti, name='III. stupeň ochrany')
stvrty_stupen=folium.plugins.FeatureGroupSubGroup(chranene_oblasti, name="IV. stupeň ochrany")
piaty_stupen=folium.plugins.FeatureGroupSubGroup(chranene_oblasti, name="V. stupeň ochrany")
m.add_child(chranene_oblasti)
m.add_child(druhy_stupen)
m.add_child(treti_stupen)
m.add_child(stvrty_stupen)
m.add_child(piaty_stupen)
Problem description
Problem with this code is that it will just add Feature group (big group) as normal "object" in Layer control and it will either turn it off / on, as individual sub groups (which are not shown like on image above, but on the same level) cant be controlled then.
@JohnyCarrot
At the current moment there's no such way of having a sort of hierarchy display of layers on the layer panel. A recent addition to folium since version 0.14.0 was the GroupedLayerControl#1592 which allows to spawn a separate layer panel (on top/bottom of the main panel) and can contain multiple layers under a group title (just text, no actual hierarchy group layer control).
It can't add raster layers to the groups (e.g: "gee" google earth engine layers) as far as I tried.
If you want one "main big group" to control all sub groups it must be in the main layer panel (do add_to(m) instead of the plugin).
If you want Main Sub Group control of all layers in that subgroup, it needs to be the last one stacked in it's layer group (see image 2. "All Group A" / "All Group B" )
NOTE:
The styling is not included in the plugin or folium. I done it to better illustrate and clarify the context.
You still can use Branca + CSS to tweak the style if wanted.
Activity
IndigoWizard commentedon Jan 27, 2023
@JohnyCarrot
At the current moment there's no such way of having a sort of hierarchy display of layers on the layer panel. A recent addition to folium since
version 0.14.0was theGroupedLayerControl#1592 which allows to spawn a separate layer panel (on top/bottom of the main panel) and can contain multiple layers under a group title (just text, no actual hierarchy group layer control).Link to official folium documentaion notebook example: GroupedLayerControl
Flaws
NOTE:
The styling is not included in the plugin or folium. I done it to better illustrate and clarify the context.
You still can use Branca + CSS to tweak the style if wanted.
JohnyCarrot commentedon Jan 29, 2023
Thanks you so much...
This is it, even if i cant control sub groups, its not that big deal.
Love you
zxdawn commentedon Sep 14, 2023
Ha, it would be nice to have big groups to turn on/off all subgroups inside and each subgroup can be controlled independently.