For some reason the getBounds()
function for Google Maps v3 seems to be extending much further than what the map is actually showing. Correct me if I'm wrong, but shouldn't it return the NE (top right corner) and SW (bottom left corner) latitude and longitude coordinates for the very corners of what's being shown in the current view?
I'm returning search results (which are mapped by a lat and lng) that are between these coordinates and am being returned results much further outside the area returned by getBounds()
. Any ideas about what could be going on here?
Just FYI, I'm getting the bounds on the map's idle event:
google.maps.event.addListener(map, 'idle', function() {
var bounds = map.getBounds();
var NE = bounds.getNorthEast();
var SW = bounds.getSouthWest();
...and using .lat() and .lng() to get the coordinates from the respective corners. Then I feed that to a SQL query that checks for results between those coordinates. Results are in the general area but can fall far outside what's actually being shown on the map.
Any ideas are appreciated! Thanks!