I have to show several brands on my google maps, one can be a very distant from the other, How i can calculate the point where i center my map, anyone can give me tips to do this, thanks
Asked
Active
Viewed 158 times
1 Answers
2
You can use the fitBounds method to help you show all items on the map at the correct zoom level:
var bounds = new google.maps.LatLngBounds();
//you can run this in a loop for all points/markers
bounds.extend(markerLatLng);
//finally
map.fitBounds(bounds);

Manatok
- 5,506
- 3
- 23
- 32
-
@Cypher, GPoint is from api v2, are you using v2 or v3? – Tomas Mar 30 '12 at 08:32
-
is for new development, I'm reviewing and I think I will use v3 and Marker objects, this link complements your answers, thanks http://stackoverflow.com/questions/3373219/how-can-i-get-the-smallest-latlngbounds-that-still-contains-a-set-of-lat-long-co – TlonXP Mar 30 '12 at 08:45