Possible Duplicate:
get current latlng bounds?
I\'m looking for the best way to use the Google maps API to ge
Use method getBounds
of the Map class.
Map.getBounds() gives you the LatLngBounds of the current viewport. You can then use LatLngBounds.getNorthEast()
and LatLngBounds.getSouthWest()
to get north-east (top right) and south-west (bottom-left) coordinates as LatLng. More specifically:
var lat0 = map.getBounds().getNorthEast().lat();
var lng0 = map.getBounds().getNorthEast().lng();
var lat1 = map.getBounds().getSouthWest().lat();
var lng1 = map.getBounds().getSouthWest().lng();