Skip to content

Instantly share code, notes, and snippets.

@xafarali
Last active August 29, 2015 14:11
Show Gist options
  • Save xafarali/b8513d312bf2105f6c85 to your computer and use it in GitHub Desktop.
Save xafarali/b8513d312bf2105f6c85 to your computer and use it in GitHub Desktop.
Google Map , zoom to bound
// map: an instance of google.maps.Map object
// latlng: an array of google.maps.LatLng objects
// latlng: needs lat, long as interger , so must parse them to interger first.
var latlngbounds = new google.maps.LatLngBounds();
for (var i = 0; i < latlng.length; i++) {
latlngbounds.extend(latlng[i]);
}
map.fitBounds(latlngbounds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment