Icon#

Example#

from ipyleaflet import Marker, Icon, Map

center = (52.204793, 360.121558)

m = Map(center=center, zoom=10)
icon = Icon(icon_url='https://leafletjs.com/examples/custom-icons/leaf-green.png', icon_size=[38, 95], icon_anchor=[22,94])
mark = Marker(location=center, icon=icon, rotation_angle=90, rotation_origin='22px 94px')
m.add_layer(mark);

m

Attributes#

class ipyleaflet.leaflet.Icon(**kwargs)[source]#

Icon class.

Custom icon used for markers.

icon_url#

The url to the image used for the icon.

Type

string, default “”

shadow_url#

The url to the image used for the icon shadow.

Type

string, default None

icon_size#

The size of the icon, in pixels.

Type

tuple, default None

shadow_size#

The size of the icon shadow, 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

shadow_anchor#

The coordinates of the “tip” of the shadow (relative to its top left corner). The same as icon_anchor if None.

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