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" <
fl0atprecis...@gmail.com> 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...