Leaflet-Marker

Leaflet Marker 是一个用于地图上展示可点击、可拖动图标的类,它继承自 Layers。本文档涵盖了Marker的使用示例、创建方法以及拖动标记的选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

L.Marker is used to display clickable/draggable icons on the
map.Extends Layers.

Usage example

L.marker([117.6,24.5]).addTo(map);

Creation

FactoryDescription
L.marker(<LatLng>latlng,<Marker options> options?`)Instantiates a Marker object given a geographical point and optionally an options object.

Options

OptionTypeDefaultDescription
iconIcon*Icon instance to use for rendering the marker. See Icon documentation for details on how to customize the marker icon. If not specified, a common instance of L.Icon.Default is used.
keyboardBooleantrueWhether the marker can be tabbed to with a keyboard and clicked by pressing enter.
titleString‘’Text for the browser tooltip that appear on marker hover (no tooltip by default).
zIndexOffsetNumber0By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
opcityNumber1.0The opcity of the marker.
riseOnHoverBooleanfalseif true,the marker will get on top of others when you hover the mouse over it.
riseOffsetNumber250The z-index offset usedfor the riseOnHover feature.
paneString‘MarkerPane’Map pane where the markers icon will be added.
shadowPaneString‘ShadowPane’Map pane where the markers shadow will be added.
bubblingMouseEventsBooleanfalseWhen true ,a mouse event on this marker will tigger the same event on the map(unless L.DomEvent.stopPropagation is used).

Draggable marker options

OptionTypeDefaultDescription
draggableBooleanfalseWhether the marker is draggable with mouse/touch or not.
autoPanBooleanfalseWhether the marker is draggable with mouse/touch or not.
autoPanPaddingPointPoint(50, 50)Distance (in pixels to the left/right and to the top/bottom) of the map edge to start panning the map.
autoPanSpeedNumber10Number of pixels the map should pan by.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值