LatLngBounds returns undefined value

265 views
Skip to first unread message

Vladimir

unread,
Oct 21, 2011, 4:21:36 PM10/21/11
to Google Maps JavaScript API v3
Hello,

i'm using v3, loading it async, creating the map object, then markers
and paths work ok, but when i try to set map bounds as

// mymap, northeast , southwest are checked and look ok
google.maps.event.addListener ( mymap , 'idle' , function ( ) {
// fit map boundaries
var bounds = new google.maps.LatLngBounds ( northeast ,
southwest ) ;
mymap.map.fitBounds ( bounds ) ;
} ) ;

LatLngBounds() still returns undef even as an event listener.

The full story is here: https://gusev.pro/test.html

Could you please advice how to get it worked?

Thanks!

Martin™

unread,
Oct 24, 2011, 12:15:55 AM10/24/11
to Google Maps JavaScript API v3
Firebug finds the error straight away!

mymap.map is undefined
https://gusev.pro/test.html
Line 66

I guess you want:

mymap.fitBounds( bounds );

Martin.
Reply all
Reply to author
Forward
0 new messages