how to know when setMap function terminated ?

10 views
Skip to first unread message

bloodycheri

unread,
Nov 29, 2011, 8:27:58 AM11/29/11
to google-map...@googlegroups.com
Hello,
I'm facing the following issue :
here is my script:

var myOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
disableDoubleClickZoom: true,
draggable: false,
keyboardShortcuts: false,
scrollwheel: false
}
mapMetropolitaine = new google.maps.Map(document.getElementById("map_metropolitaine"), myOptions);
var ctaLayerMetro = new google.maps.KmlLayer('http://www.mywebsite.com/METROPOLE.KML');
ctaLayerMetro.setMap(mapMetropolitaine);
mapMetropolitaine.setZoom(6);
var centre = new google.maps.LatLng(46, 2);
mapMetropolitaine.setCenter(centre);

The problem is that the setCenter and setZoom functions are executed before the KmlLayer is fully deployed. So it sets the new zoom and then it ends the KmlLayer deployment (done by setMap). So I was just wondering how to be sure the KmlLayer is deployed before I change any map options.

i was thinking of using the following code :

google.maps.event.addListener(ctaLayerMetro, "myevent", function() {
mapMetropolitaine.setZoom(6);
});

but I have no idea of the event to call.

Best Regards.
Reply all
Reply to author
Forward
0 new messages