Make DivIcon and CustomIcon work with the new Marker approach by Conengmo · Pull Request #2119 · python-visualization/folium
Earlier we made this change for Marker and Icon (#2068), where the Icon template no longer adds itself to its parent. Instead, the Marker contains code to add its icon to itself. This makes it so that an icon can be reused for multiple markers.
At the time we didn't also apply this to DivIcon and CustomIcon. But it works for them in the same way and solves the same issue.
This should close #744 and also close #1885.
TODO
-
This PR should fix the regression introduced by Fix icon when passing Marker to GeoJson #2086, where marker.add_child(icon) broke.
-
This PR needs some rigorous tests to make sure it works robustly for all cases, like passing icon as a parameter, or doing
marker.add_child(icon)oricon.add_to(marker).