百度有没有类似GoogleMap的fitBounds?我在百度地图上有多个标记,我想用适当的位置和缩放级别显示所有的标记。
发布于 2015-08-04 07:24:49
只是偶然发现了这条线索。这个问题的答案是:
var points = [Point_1,...,Point_n];
map.setViewport(points);
points
只是一个数组,其中包含您希望在地图视口中使用的BMap.Point
类型的对象。
文档:http://developer.baidu.com/map/reference/index.php?title=Class:%E6%80%BB%E7%B1%BB/%E6%A0%B8%E5%BF%83%E7%B1%BB
发布于 2019-09-25 15:49:26
虽然this answer为我工作,但通过更改直接的latlng
对象而不是BMap.Point
对象来使其工作。
发布于 2015-05-06 19:09:54
可以在百度地图上显示多个标记。
Check their example here
我用230x125的面积展示了百度地图,所以我在下面的区域展示了中国:
var map = new BMap.Map("id_of_map_loading_area");
var point = new BMap.Point(101.841797,35.433724); //China on the center of the area
map.centerAndZoom(point,3); // Change value 3 to see difference
map.enableScrollWheelZoom(); // Zoom effect to the map using mouse.
https://stackoverflow.com/questions/28316976
复制相似问题