Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions folium/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,11 @@ def __init__(
self.options = remove_empty(
draggable=draggable or None, autoPan=draggable or None, **kwargs
)
# this attribute is not used by Marker, but by GeoJson
self.icon = None
if icon is not None:
self.add_child(icon)
self.icon = icon
if popup is not None:
self.add_child(popup if isinstance(popup, Popup) else Popup(str(popup)))
if tooltip is not None:
Expand All @@ -421,15 +424,12 @@ 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, CustomIcon, DivIcon)):
self.add_child(self.SetIcon(marker=self, icon=child))
if self.icon:
self.add_child(self.SetIcon(marker=self, icon=self.icon))
super().render()


Expand Down
Loading