SSukha 地图开发者文档

覆盖物

6.1 Marker

const shop = new sdk.Marker({map,position:[100.02228,21.67623],title:'门店',anchor:'bottom'});
shop.on('click',() => console.log(shop.getPosition()));
shop.setPosition([100.023,21.677]);
shop.setAngle(90);
参数 / 方法 说明
position 必填,LngLatLike
icon 图片 URL 字符串;本版不是高德 Icon 对象
content 文本或 HTMLElement;富内容优先 HTMLElement
anchor center、top、bottom、left、right、top-left、top-right、bottom-left、bottom-right
offset Pixel / [x,y]
draggable / visible 可拖动、初始可见性
angle / setAngle 角度
zIndex / setzIndex 层叠顺序;方法 z 为小写
extData / setExtData / getExtData 宿主附加数据
show / hide / setMap(null) 显示、隐藏、解除地图绑定

6.2 Polyline、Polygon、Circle

/** @type {[number,number][]} */
const path = [[100.022,21.676],[100.024,21.678],[100.026,21.676]];
const line = new sdk.Polyline({map,path,strokeColor:'#1268e5',strokeWeight:5,strokeOpacity:0.9});
const polygon = new sdk.Polygon({map,path,fillColor:'#1268e5',fillOpacity:0.15});
const circle = new sdk.Circle({map,center:path[0],radius:100,fillOpacity:0.15});
map.setFitView([line],true,[32,32,120,32],18);

path 为点数组;strokeWeight 为线宽,透明度 0–1;radius 为米。Polyline 提供 getLength、getBounds、setPath、setOptions;Polygon 提供 getArea、contains;Circle 提供 setCenter/setRadius。面积单位平方米。

6.3 InfoWindow

const info = new sdk.InfoWindow({content:'门店说明',closeWhenClickMap:true});
info.open(map,[100.02228,21.67623]);
// info.setContent(element); info.close(); info.destroy();

content 字符串按纯文本展示,不解析 HTML。富文本请构造可信 HTMLElement,并用 textContent 写入外部文字。参数还包括 position、offset、size;getIsOpen 读取状态。

6.4 平滑移动

shop.moveTo([100.024,21.678],{duration:1500});
// shop.pauseMove(); shop.resumeMove(); shop.stopMove();

moveAlong 支持路径动画,参数以 MoveOptions/MovePath 声明为准。动画展示不替代真实定位、上传或导航计算;对象移除时应停止动画。