根据点的经纬度控制地图显示范围:
//创建点 var point1 = new BMap.Point(lng1,lat1); var point2 = new BMap.Point(lng2,lat2); var points = [point1, point2]; var view = map.getViewport(eval(points)); var mapZoom = view.zoom; var centerPoint = view.center; map.centerAndZoom(centerPoint,mapZoom);