自动缩放地图到合适的视野级别
谷歌地图自动缩放地图到合适的视野级别
参考代码
// https://developers.google.cn/maps/documentation/javascript/reference/map#Map.panToBounds
var bounds = new google.maps.LatLngBounds();
bounds.extend(paths[j]);
map.panToBounds(bounds);
百度地图自动缩放地图到合适的视野级别
参考代码
var view = map.getViewport(eval(points));
var mapZoom = view.zoom;
var centerPoint = view.center;
map.centerAndZoom(centerPoint, mapZoom);
bing地图自动缩放地图到合适的视野级别
参考代码
// http://www.bingmap.cn/guide/e26d7e9c-dafe-11e8-a803-d46d6d978bfa?module=doc
var fromLocations = new Microsoft.Maps.LocationRect.fromLocations(bounds);
map.setView({bounds: fromLocations });
高德地图自动缩放地图到合适的视野级别
参考代码
map.setFitView();