-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
For Markers, CircleMarkers, etc. if adding className as an extra kwarg, it is not propagated to the js-code initializing the leaflet map, even though the documentation somewhat suggests it:
**kwargs
Other valid (possibly inherited) options. See:
https://leafletjs.com/reference.html#circlemarker
Having the possibility to add class-strings to the generated map, greatly improves the usability of Folium (at least for me), as it allows the developer to add extra interactivity client-side in javascript via simple css selectors, e.g. hiding showing selected stuff on the map on js-events.
To Reproduce
Add className='my_class_str' to any Marker.
Inspect map in browser and e.g. search for my_class_str.
It does not show up.
Expected behavior
class = "my_class_str" added to html elements for Markers
Environment (please complete the following information):
- chrome
- html files
- Python version: 3.9
- folium version: 0.14.0
- branca version: 0.6.0
Additional context
Seems like this might have been reported before:
#730
But if it was fixed or not seems unclear to me
Possible solutions
Seems like there is a VERY simple fix, by just adding "className": kwargs.pop("className", '') when initializing the default dict in path_options() in vector_layers.py
It works for me, but I do not know if there are use-cases I'm unaware of, or if it results in other unwanted side-effects.
Thanks for a great package!