MapLabel

map 的 addMapLabels 方法支持向底图上添加可参与碰撞的 label *

interface MapLabel {
    direction?: 0 | 1 | 2 | 3 | 4;
    displayRange?: [number, number];
    position: Point;
    rank?: number;
    style?: MapLabelStyle;
    text?: string;
    textMargin?: number;
    type?: string;
    uid?: string;
}

属性

文字位于坐标的方向,取值为:0, 1, 2, 3, 4 分别表示bottom, right, top, left, center

显示的级别范围,[fromZoom, toZoom]

标注位置,经纬度坐标

权重,值越高优先级越高

样式配置信息

显示的文字内容

文字距离坐标位置的像素边距

类型,默认为fixed(固定标注),此外还有line(道路标注)、biaopai(标牌)

唯一标识,不传则自动生成