Is there an equivalent in Baidu like fitBounds in GoogleMap? I have multiple markers on a Baidu map and I would like to show all the markers with the proper positioning and zoom level.
Fit Baidu map to multiple markers like Google Maps fitBounds
3.2k Views Asked by Dino Dinelli At
3
There are 3 best solutions below
0
On
Just stumbling upon this thread. The answer to this question is:
var points = [Point_1,...,Point_n];
map.setViewport(points);
points is simply an array containing objects of type BMap.Point that you want within the map viewport.
0
On
Although this answer worked for me, with the change of direct latlng object instead of BMap.Point object to make it work.
It is possible to show multiple markers on Baidu Map.
Check their example here
I have displayed Baidu Map with an area of 230x125 so I have shown the China on the area like below: