This is because longitudes wrap around at -180 = 180 degrees. Focusing just on the longitudes: 1 - First you add the point -56 2 - Then you add the point -118. The bounds are now [-118, 56]. 3 - Lastly you add the point 126. The smallest bounds containing 126 and the previous bounds is [126, -56], which crosses 180 as you observe.
Android brevity On Aug 20, 2011 8:01 AM, "DiTieM" <dit...@gmail.com> wrote: > Just got this simple test case: > > var bounds = new google.maps.LatLngBounds( ) ; > > bounds.extend( new google.maps.LatLng( -34, -56 ) ) ; > bounds.extend( new google.maps.LatLng( 34, -118 ) ) ; > bounds.extend( new google.maps.LatLng( 25, 121 ) ) ; > > console.log( [ bounds.getSouthWest( ).lat( ) > , bounds.getSouthWest( ).lng( ) > , bounds.getNorthEast( ).lat( ) > , bounds.getNorthEast( ).lng( ) ] ) ; > > I might be totally wrong, or missing something, but I would expect to get a > bounding box like: > [-34, -118, 25, 121] > > (The order is (SW-lat, SW-lng, NE-lat, NE-lng) > > But I get this (from google maps) > > [-34, 121, 34, -56] > > Is this a bug or someone can explain this to me? > > Thanks a lot, > David > > -- > You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. > To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/iLOwWNeyWQ0J. > To post to this group, send email to google-maps-js-api-v3@googlegroups.com. > To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.