DivIcon#
Example#
from ipyleaflet import Marker, DivIcon, Map
center = (52.204793, 360.121558)
m = Map(center=center, zoom=10)
icon = DivIcon(html='foo bar', bg_pos=[0, 0], icon_size=[150, 150])
mark = Marker(location=center, icon=icon)
m.add_layer(mark);
m
Attributes#
- class ipyleaflet.leaflet.DivIcon(**kwargs)[source]#
DivIcon class.
Custom lightweight icon for markers that uses a simple <div> element instead of an image used for markers.
- html#
Custom HTML code to put inside the div element, empty by default.
- Type
string
- bg_pos#
Optional relative position of the background, in pixels.
- Type
tuple, default [0, 0]
- icon_size#
The size of the icon, in pixels.
- Type
tuple, default None
- icon_anchor#
The coordinates of the “tip” of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker’s geographical location. Centered by default if icon_size is specified.
- Type
tuple, default None
- popup_anchor#
The coordinates of the point from which popups will “open”, relative to the icon anchor.
- Type
tuple, default None