百度地图自动缩放

时间:2015-07-21 12:11:25

标签: baidu

我正在使用百度创建交互式地图。有谁知道如何在百度/自动缩放中使用绑定?百度地图有自动缩放功能吗? 我在他们的文档上找不到任何内容。也许有中文,但我不会读中文:(

百度文档:http://developer.baidu.com/map/index.php?title=jspopular

也找到了这个,但我找不到任何关于如何使用它的说明。 http://developer.baidu.com/map/reference/index.php?title=Class:%E5%9F%BA%E7%A1%80%E7%B1%BB/Bounds

提前谢谢!

1 个答案:

答案 0 :(得分:1)

找到解决方案!将标记点存储到数组并使用getViewport()方法获取计算的中心和缩放。希望这对任何人都有帮助。

map_center = map.getViewport( array_of_marker_points);
map.centerAndZoom( map_center.center.lng , map_center.center.lat , map_zoom);