Created
September 4, 2015 13:30
-
-
Save thiagoeliasr/970417ff9c8fb7ce9c9f to your computer and use it in GitHub Desktop.
Google Maps API: Center / Zoom in bounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new viewpoint bound | |
var bounds = new google.maps.LatLngBounds(); | |
// Go through each... | |
for (var i = 0, LtLgLen = _latlng.length; i < LtLgLen; i++) { | |
// And increase the bounds to take this point | |
bounds.extend (_latlng[i]); | |
} | |
// Fit these bounds to the map | |
map.fitBounds(bounds); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment