Hello to everyone,

In the map I'm working on, I would like to activate a kml layer when
pressing a custom control. The layer then is displayed onto the map.

I also would like to show kml metadata description inside a page
element. The problem is that, when I clik on the control to show the
kml layer, metadata is still undefined. But next time I click,
metadata is well defined.

Some pseudocode to show the problem:

var
metadata;                                                                //
define somewhere above
// Custom control listener
google.maps.event.addDomListener(controlUI, 'click', function() {

   if (TourLayer.getMap() == null)
{                                    // if layer is not displayed

 
TourLayer.setMap(map);                                           //
display map
      controlText.innerHTML = 'Tour ON';
      metadata = TourLayer.getMetadata ();                        //
metadata is undefined on the first call
      showInDiv (metadata.name, metadata.description);
   }
   else {

      TourLayer.setMap();
      controlText.innerHTML = 'Visita OFF';
   }
});

Is there a way to get kml layer metadata before the layer is showed in
the map for the first time?

I am doing something wrong?

Thanks for your help.

-- 
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=en.

Reply via email to