Multiple markers with one icon by Conengmo · Pull Request #2068 · python-visualization/folium
Based on the comments on #2053 I made a new version that sets the icon from the markers perspective. This is also similar to how Layer works.
m = Map((44, -93), tiles="cartodb dark matter", zoom_start=8)
icon = Icon(icon='music')
markers = [
Marker((52, 5), icon=icon, popup="0"),
Marker((52, 5.1), icon=icon, popup="1"),
Marker((52.1, 5)),
Marker((52.1, 5.1)),
]
Icon(icon="cloud").add_to(markers[-1])
fg = FeatureGroup(name='group').add_to(m)
for marker in markers:
marker.add_to(fg)
FitOverlays(padding=10).add_to(m)
If this approach looks good, I'll generate some test cases.
Not sure how much of a breaking change this is. From a direct user perspective, I don't think there's an issue. Not sure about packages that use Folium internals though.