Hey guys.
I started working on a project using the Google Maps API v3 yesterday.
I'm going to use the map as a membermap for a clan cms (webSpell)
based on the mysql-databse. It's working, and I don't get any errors.
But there is one thing: the correct zoom and center location. For
every user (or city, if there are more users in a city) there is a
marker, and I wanted to base the centerlocation and the zoom on all
those markers, using the following script:
function fitMap (map, markers) {
var bounds = new google.maps.LatLngBounds();
for (var _marker in markers) {
bounds.extend(markers[_marker]);
}
map.set_zoom(map.getBoundsZoomLevel(bounds));
map.set_center(bounds.getCenter());
}
If I open the page, firebug throws out the following error:
map.getBoundsZoomLevel is not a function
So, my question is: how do I use getBoundsZoomLevel with API v3? I
only found it for v2. For the whole script, visit
http://www.apocalyptic-death.de/googlemaps.php (there is no php-code
at all, don't care about the extension). As you might see, I set the
current location by hand that Germany, Austria and Swiss are at least
shown, but thats not perfect. Hope you are able to help me.
Best Regards,
PitBull