I have added a kml to google earth by use of button with javascript. How can I delete that kml or clear all kml's by use of another button? thanks
+1
A:
Do you mean you added a KML file? I guess you did this by adding a "network link" using functions like
var networkLink = ge.createNetworkLink('ID_MyNetworkLink');
var link = ge.createLink('MyHREF');
link.setHref('http://bla.bla.bla.kml');
networkLink.setLink(link);
ge.getFeatures().appendChild(networkLink);
So your "file" is a child of the whole KML tree with id "ID_MyNetworkLink". You can remove it by
ge.getFeatures().removeChild(ge.getElementById('ID_MyNetworkLink'));
Hope that helps
MikeD
2010-05-28 11:18:15
A:
To remove all the features you can use the following method. It presumes that 'ge' references your plug-in object.
function RemoveAllFeatures()
{
var features = ge.getFeatures();
while (features.getLastChild() != null)
{
features.removeChild(features.getLastChild());
}
}
Fraser
2010-07-19 02:58:45