Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class_name argument to more map elements #2055

Open
pixelsapphire opened this issue Dec 16, 2024 · 1 comment
Open

Add class_name argument to more map elements #2055

pixelsapphire opened this issue Dec 16, 2024 · 1 comment
Labels
enhancement Feature request or idea about how to make folium better help wanted Help is welcome for this issue or PR

Comments

@pixelsapphire
Copy link

LeafletJS reference mentions a className option for several classes, such as Path (https://leafletjs.com/reference.html#path). The option is used to give elements custom CSS classes. It is implemented in Folium as the class_name keyword argument, but it is currently only available for DivIcon and GeoJsonPopup.
I would like to be able to give custom classes to PolyLine elements (and other BaseMultiLocation elements) via the class_name keyword argument.
Currently, I'm abusing the fill_color argument (and setting fill_opacity=0) as a place to store the classes to be later accessed and properly added by a JS script, but this solution is far from perfect, to put it mildly.

@Conengmo
Copy link
Member

Conengmo commented Dec 17, 2024

This is a good point. Classes like PolyLine accept **kwargs, but then this gets stripped in the path_options function.

I don't think we should add class_name as explicit keyword arguments, but we should allow users to pass it through **kwargs.

We should add className as a valid option in the **kwargs of path_options. Should be easy to add and test for. PR's are welcome!

@Conengmo Conengmo added enhancement Feature request or idea about how to make folium better help wanted Help is welcome for this issue or PR labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or idea about how to make folium better help wanted Help is welcome for this issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants