百度地图根据坐标点自动调整视图等级
程序员文章站
2022-03-04 12:33:15
...
//初始化地图
querymap = new BMap.Map("abc");
var point = new BMap.Point(90, 100);
var shopPoint= new BMap.Point(20, 100);
//提供点坐标数组
var pointArray =new Array(point,shopPoint)
//3.根据点坐标调整地图等级
setViewPort(pointArray,shopGoodMap)
function setViewPort(pointArray,map){
var viewPort = map.getViewport(pointArray)
map.centerAndZoom(viewPort.center, viewPort.zoom);
console.log(viewPort)
console.log(pointArray)
}
上一篇: C# 窗体居中
下一篇: 百度地图定位核心代码