With my own testing, it appears that getMetadata only returns an
object after the layer has finished rendering. Intuitively this makes
sense. However the problem is there isn't an event directly designed
to tell you when this is ready. I was able to use the tilesloaded
event on the map to accomplish the same thing though.

map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
ctaLayer = new google.maps.KmlLayer('http://gmaps-
samples.googlecode.com/svn/trunk/ggeoxml/cta.kml');
google.maps.event.addListenerOnce(map, 'tilesloaded', function()
{ console.log(ctaLayer.getMetadata()) });
ctaLayer.setMap(map);

Chad Killingsworth

On Jun 4, 8:15 pm, "this.me" <[email protected]> wrote:
> Good evening,
>
> I am having the hardest time interpreting the API reference for
> getMetadata.
>
> Assuming my KmlLayer object is kmllayer, then:
>
> kmllayer.getUrl() returns the Url, kmllayer.setMap(map) renders the
> overlay on the map but kmllayer.getMetadata() returns undefined.
>
> kmllayer.getMetadata.name returns blank,
> kmllayer.getMetadata.description returns undefined.
>
> Can anyone provide an example of the proper syntax for using
> getMetadata?
>
> Thanks much.
>
> Also, there is an error in the example code under the KML Feature Data
> at:http://code.google.com/apis/maps/documentation/javascript/overlays.ht...
>
> The example reads:
> google.maps.event.addListener(ctaLayer, 'click',
> function(kmlEvent) ...
>
> Unfortunately, ctaLayer is undefined.  The actual layer should be
> nylayer, as per the original declaration.

-- 
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