0

I'm creating an interactive map using baidu. Anyone knows how to use bound in Baidu / auto zoom? Is there any auto zoom function in Baidu map? I can't find anything on their documentation. Maybe there is but it's in Chinese, I can't read Chinese :(

Baidu documentation: http://developer.baidu.com/map/index.php?title=jspopular

Also found this but i cant find any instruction on how to use it. http://developer.baidu.com/map/reference/index.php?title=Class:%E5%9F%BA%E7%A1%80%E7%B1%BB/Bounds

THanks in advance!

Wreeecks
  • 2,186
  • 1
  • 33
  • 53

1 Answers1

1

Found the solution! Store marker points to an array and use getViewport() method to get the computed center and zoom. Hope this find helpful to anyone.

map_center = map.getViewport( array_of_marker_points);
map.centerAndZoom( map_center.center.lng , map_center.center.lat , map_zoom);
Wreeecks
  • 2,186
  • 1
  • 33
  • 53