problem with getBounds()

65 views
Skip to first unread message

Merav Ben Harush

unread,
Nov 6, 2011, 3:46:10 AM11/6/11
to google-map...@googlegroups.com
Hello,

I initialized the map, the map.getCenter() and map.getZoom() are set.
meaninng all the items that needs to be set in order that the function getBounds will return the map bounds, are set and returning the correct response (not null or undefined).
but for some reason the function getBouds()  return undefined.

what do i need to do in order that the function will work correctly?

Thanks!

Rossko

unread,
Nov 6, 2011, 5:38:53 AM11/6/11
to Google Maps JavaScript API v3
> what do i need to do in order that the function will work correctly?

For general advice, you could search this group for similar threads,
like this one
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/563ed63c2bd60749/ee6d047bc060c46c

For specific advice, you'd have to share a link to your map

Merav Ben Harush

unread,
Nov 7, 2011, 1:34:29 AM11/7/11
to google-map...@googlegroups.com
I read this post, that's the reason i wrote that all the neccessary item are initialized and set ("I initialized the map, the map.getCenter() and map.getZoom() ").

I don't have a way to post a link, because it's in an internal system.

everything else, works just fine. only when it comes to getBounds() i get undefined.

any clue?

DiTieM

unread,
Nov 7, 2011, 3:08:25 AM11/7/11
to google-map...@googlegroups.com
Have you tried this?

(from Rossko thread)
"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. "
Reply all
Reply to author
Forward
0 new messages