代码
const map = new BMap.Map('map');
map.centerAndZoom(new BMap.Point(118.454, 32.955), 6);
map.enableScrollWheelZoom();
var beijingPosition = new BMap.Point(116.432045, 39.910683),
hangzhouPosition = new BMap.Point(120.129721, 30.314429),
taiwanPosition = new BMap.Point(121.491121, 25.127053);
var points = [beijingPosition, hangzhouPosition, taiwanPosition];
var curve = new BMapLib.CurveLine(points, {
strokeColor: 'blue',
strokeWeight: 3,
strokeOpacity: 0.5,
}); // 创建弧线对象
map.addOverlay(curve); // 添加到地图中
curve.enableEditing(); // 开启编辑功能
BMapLib.CurveLine 绘制弧线。如果你使用 JSAPI4.0,建议用 BMap.BezierCurve
预览