Appearance
LabelMarker
LabelMarker
标注类,支持大量点标注和文本标注的绘制,基于LabelLayer图层绘制
Examples
javascript
const labelMarker = new DiMap.LabelMarker({
position: [116.405467, 39.907761],
zooms: [0, 22],
opacity: 1,
zIndex: 1,
icon: {
image: "https://xxx.com/marker.png",
size: [46 * 0.6, 66 * 0.6],
anchor: "bottom",
offset: [0, 4]
},
text: {
content: "文字内容",
direction: "top",
offset: 0,
style: {
fontSize: 12,
fillColor: "#000"
}
}
})
const labelLayer = new LabelLayer({
visible: true,
opacity: 1,
collision: true,
zooms: [0, 22]
})
labelLayer.add(labelMarker)
labelLayer.addToMap(map)constructor
Parameters
optionsLabelMarkerOptions 标注属性
setLabelMarkerOptions
设置标注属性
Parameters
optionsPartial<LabelMarkerOptions> 标注属性
Returns this
getLabelMarkerOptions
获取标注属性
Returns LabelMarkerOptions 标注属性
getPosition
获取标注位置
Returns LngLatLike 标注位置
show
显示标注
Returns this
hide
隐藏标注
Returns this
TextDirection
文字方向
Type: string
Properties
left"left"左right"right"右top"top"上bottom"bottom"下
LabelMarkerOptions
标注属性
Properties
positionLngLatLike 标注位置opacitynumber? 默认1zIndexnumber? 默认1iconObject? 图标textObject? 文字
