I'm trying to set the bounds of a map fitbounds doesnt work because it puts some space around the bounds therefore doing
{{{map.fitBounds(map.getBounds())}}}
a few times will quickly zoom the map out
I need to be able to do
{{{map.setBounds(map.getBounds())}}}
and for nothing to happen
The maximum size we can provide is 2048 x 2048 pixels.
The Google Maps APIs now support you in creating beautiful styled maps for your Android and iOS apps as well as your website using the same JSON style object.
If I'm not mistaken, I'm assuming you want all your points to be visible on the map with the highest possible zoom level. I accomplished this by initializing the zoom level of the map to 16(not sure if it's the highest possible zoom level on V3).
var map = new google.maps.Map(document.getElementById('map_canvas'), { zoom: 16
, center: marker_point
, mapTypeId: google.maps.MapTypeId.ROADMAP
});
Then after that I did the bounds stuff:
var bounds = new google.maps.LatLngBounds();
//you can have a loop here of all you marker points
//begin loop
bounds.extend(marker_point);
//end loop
map.fitBounds(bounds);
Result: Success!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With