Maximum Lat and Long bounds for the world - Google Maps API LatLngBounds()

The links provided by @Marcelo & @Doc are good for understanding the derivation of the Lat Lng:

  • http://www.cienciaviva.pt/latlong/anterior/gps.asp?accao=changelang&lang=en
  • https://groups.google.com/forum/?hl=en&fromgroups=#!msg/google-maps-api/oJkyualxzyY/pNv1SE7qpBoJ
  • https://en.wikipedia.org/wiki/Mercator_projection#Mathematics_of_the_Mercator_projection

But if you just want an answer for the maximum bounds for Google Maps:

Latitude: -85 to +85 (actually -85.05115 for some reason)

Longitude: -180 to +180

Try it for yourself on the Google Maps:

  • https://maps.google.com/?q=85,180
  • https://maps.google.com/?q=-85.05115,180

(You may need to Zoom Out. See how the pin is at the "edge" of the world - these are the limits)

So in your code Try:

var strictBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng(85, -180),           // top left corner of map
    new google.maps.LatLng(-85, 180)            // bottom right corner
);

Please edit this wiki (or update your question) once you have the answer. Thanks


See this post in the old Google Groups, which describes the math of the projection.

Quote:

the map doesn't start at 85 degrees, but rather the degree that makes the map square. This is can be simply calaculated as: atan(sinh(PI)) *180 / PI = 85.05112878....

Note that the tile calculation in that post is for the old API V2, but the projection should be the same.


You may do the following to get the Max Lat and Long bounds of the world with the help of Google Maps :

1: Set the Zoom Level 1 of Google Maps While setting up the Google Map Stuff :

mapOptions = {
                zoom: 1,
 .....
}

2. Do the following to get NorthEast and SouthWest Bound of this Map :

map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

     // NorthEast Latitude : 89.45016124669523
     var latNEValue =  map.getBounds().getNorthEast().lat();
    // NorthEast Longitude : 180
     var longNEValue = map.getBounds().getNorthEast().lng();
     // SouthWest Latitude : -87.71179927260242
     var latSWValue =  map.getBounds().getSouthWest().lat();
     // Southwest Latitude :  -180
     var longSWValue = map.getBounds().getSouthWest().lng();

3. It will give you following NorthEast and SouthWest Bounds :

NorthEast Latitude : 89.45016124669523

NorthEast Longitude : 180

SouthWest Latitude : -87.71179927260242

Southwest Longitude : -180

Similarly on Zoom Level- 0 , It give following points :

NorthEast Latitude : 89.99346179538875

NorthEast Longitude : 180

SouthWest Latitude : -89.98155760646617

Southwest Longitude : -180

Above trick helped me to solve my business problem which required max lat/long.