python-visualization / folium

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

Add a custom container to the realtime plugin #1869

Closed hansthen closed 8 months ago

hansthen commented 9 months ago

Add the container parameter from the leaflet realtime plugin to the Folium realtime plugin. So far, only tested with MarkerCluster. Also add tests and improved the documentation.

hansthen commented 9 months ago

pre-commit.ci autofix

Conengmo commented 8 months ago

This looks good Hans, the docstring is pretty clear so I hope users can work with this.

More longterm, we can add LayerGroup as an abstract base class to indicate something that will generate a L.LayerGroup javascript object. That way we can make the Python class hierarchy mimic the Leaflet class hierarchy.

Though that does make sense, I'm hesitant from a complexity perspective. Adding a core Folium class doesn't seem to weigh up to facilitating a single type hint for an optional argument in a single plugin. Having too many layers of class inheritance makes things more complicated to understand. So I think I'm fine with how it's solved now.

I'll go ahead and merge it now. Thanks for your contribution to Folium!