Hi, The bounds is not calculated until the map is fully initialized or updated. The bounds is only available asynchronously after a call to setCenter or setZoom. You should listen to the 'bounds_changed' event on the map before calling getBounds(). You may also find the 'idle' event useful.
Here is an excerpt from the conceptual documentation: Note: If you are trying to detect a change in the viewport, be sure to use the specific bounds_changed event rather than constituent zoom_changed and center_changed events. Because the Maps API fires these latter events independently, getBounds() may not report useful results until after the viewport has authoritatively changed. If you wish to getBounds() after such an event, be sure to listen to the bounds_changed event instead. I hope this helps. -Susannah -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=.
