Why getBounds().getSouthWest() sometimes returns bottom-right coordinates instead of bottom-left coordinates?
I get the boundaries of my visible map like this:
var bounds = map.map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var minLat = southWest.lat();
var maxLat = northEast.lat();
var minLong = southWest.lng();
var maxLong = northEast.lng();
Most of the time this works fine. bounds.getSouthWest() returns the
bottom-left coordinates and bounds.getNorthEast() returns the top-
right coordinates.
But when I cross the longitude of 180 (the point where 180 degrees
turns into -180 degrees), I start getting weird results for the
boundaries. To me it seems that bounds.getSouthWest() returns the
bottom-RIGHT coordinates and bounds.getNorthEast() returns top-LEFT
coordinates.
Here is a picture where this has happened:
http://google-maps-api.googlegroups.com/web/screenshot.png?gsc=bOT3FAsAAAD4-eP2_Nc0eBwShbtUNUUj
In the pic you can see that bounds.getSouthWest().lng() returns a
positive value although it should return a negative value.
And bounds.getNorthEast().lng() returns a negative value although it
should return a positive value.
How can I be sure to always get the bottom-left coordinates of the map?
--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home