Kosmo零
Kosmo零

Reputation: 4151

How to loop through loaded KML in maps api v3?

I need to get markers, overlays and etc, that were loaded from KML, but i don't understand how.
Here https://groups.google.com/forum/?fromgroups=#!topic/umapper/YCfHEWaCxMc is written that i can loop through KMLayer. but i can't!

I loading KML that way:

var nyLayer = new google.maps.KmlLayer("http://www.searcharoo.net/SearchKml/newyork.kml", { suppressInfoWindows: true, map: map });

Then i don't see anyway to find what objects inside. I tried to look in debugger what nyLayer contain inside, but nothing like objects array. Also tried this:

var test = nyLayer[0];

But test is undefined

Upvotes: 0

Views: 868

Answers (1)

geocodezip
geocodezip

Reputation: 161404

You can't access the Placemarks in a KmlLayer other than by using a click listener.

You can access them if you use a third party parser like geoxml3 or geoxml-v3, but then you lose the advantage of the KmlLayer's tile based rendering, so you will see performance degradation for large numbers of objects.

Example which creates a dynamic sidebar using geoxml3

Upvotes: 1

Related Questions