I'm creating a program with Python that finds the best routes for workers. It display a map with their itinerary and time of itinerary. I have 3 layers, one for each transport car, metro and bike. When i tick or unticked them it display or erase them from the map. I would like to have the same features but with the duration of the run. Like if there was layers inside each one of the first 3 layers.
layerVoiture = folium.FeatureGroup(name=description, overlay=False, control=True)
Some code describing the layer :
layerVoiture.add_to(myMap)
mapTile = folium.TileLayer(tiles='OpenStreetMap') #StamenToner
mapTile.add_to(layerVoiture)
it displays this i would like to make the left part, where the duration of runs are displayed, tickable or untickable
Thanks for your help
you can use FeatureGroupSubGroup
to create groups within your FeatureGroup
.
For example:
from folium import plugins
group_0_15 = plugins.FeatureGroupSubGroup(layerVoiture, name="De 0 à 15 minutes", show=False, overlay=False)
I am working on something similar and still have one issue: I can't combine radio buttons (set with overlay=False
) and check boxes (set with overlay=True
) in the legend (LayerControl
). They are in two seperate areas in the legend. Here is an example.
So if you only want to use radio buttons or check boxes, it should work. In my case, I am using only check boxes even though it is not exactly what I was looking for. Here is what I achieved, by creating 3 sub-groups in each group.
I hope it still helped!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With