Reputation: 733
I have a KML file with multiple placemarks, example below:
<Placemark>
<name>00550M</name>
<description></description>
<styleUrl>#550M</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<tessellate>1</tessellate>
<coordinates>
-019.2041,63.4130
-013.2722,57.0138
004.2309,52.4405
001.1318,49.5607
-021.0657,55.3650
-019.2041,63.4130
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
Using the Earth plugin I can turn populate an array with the placemarks :
if ('getFeatures' in top.mykml) {
var firstChild = top.mykml.getFeatures().getFirstChild();
while(firstChild !== null){
top.myObjects.push(firstChild);
firstChild = firstChild.getNextSibling();
}
}
and make them visible or not :
for (var i = 0; i < aLen; i++){
aName = top.myObjects[i].getName();
aFL = (aName.substring(2, 5));
if (aFL == '200'){
top.myObjects[i].setVisibility(true);
}
}
However, getFeatures isn't available in Maps, and
if ('featureData' in top.mykml)
returns false.
Is it possible to achive what I want to do, if so how. If not I guess each placemark will have to go in a single file.
Thanks.
Upvotes: 0
Views: 587
Reputation: 161404
KmlLayer doesn't give you access to the objects on the map.
You have two options that I can think of:
Upvotes: 1