Skip to content

Commit

Permalink
also add customicon and divicon
Browse files Browse the repository at this point in the history
  • Loading branch information
Conengmo committed Jan 1, 2025
1 parent b9488ff commit e7569a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions folium/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class Marker(MacroElement):
folium.Popup or a folium.Popup instance.
tooltip: str or folium.Tooltip, default None
Display a text when hovering over the object.
icon: Icon plugin
icon: Icon, CustomIcon or DivIcon, optional
the Icon plugin to use to render the marker.
draggable: bool, default False
Set to True to be able to drag the marker around the map.
Expand Down Expand Up @@ -418,12 +418,14 @@ def _get_self_bounds(self) -> TypeBoundsReturn:
return cast(TypeBoundsReturn, [self.location, self.location])

def render(self):
from .features import CustomIcon, DivIcon

if self.location is None:
raise ValueError(
f"{self._name} location must be assigned when added directly to map."
)
for child in list(self._children.values()):
if isinstance(child, Icon):
if isinstance(child, (Icon, CustomIcon, DivIcon)):
self.add_child(self.SetIcon(marker=self, icon=child))
super().render()

Expand Down

0 comments on commit e7569a5

Please sign in to comment.