Note that there are some explanatory texts on larger screens.

plurals
  1. POcreating a Placemarks that can be hidden
    text
    copied!<p>I have been trying to create a Placemark that I can hide and show (like turning visibility on and off) on demand (on click)... I am using this to make the placemark:</p> <pre><code>function placemark(lat, long, name, url, iconsrc){ var placemark = ge.createPlacemark(name); ge.getFeatures().appendChild(placemark); placemark.setName(name); // Create style map for placemark var icon = ge.createIcon(''); if(iconsrc == "0") icon.setHref('http://maps.google.com/mapfiles/kml/paddle/red-circle.png'); else{ icon.setHref(iconsrc); } var style = ge.createStyle(''); style.getIconStyle().setIcon(icon); if(iconsrc != "0") style.getIconStyle().setScale(2.5); placemark.setStyleSelector(style); // Create point var point = ge.createPoint(''); point.setLatitude(lat); point.setLongitude(long); //point.setAltitudeMode(1500); placemark.setGeometry(point); google.earth.addEventListener(placemark, 'click', function(event) { // Prevent the default balloon from popping up. event.preventDefault(); var balloon = ge.createHtmlStringBalloon(''); balloon.setFeature(placemark); // optional balloon.setContentString( '&lt;iframe src="'+ url +'" frameborder="0"&gt;&lt;/iframe&gt;'); ge.setBalloon(balloon); }); } </code></pre> <p>I have tried everything... from this:</p> <pre><code>function hidePlacemark(name){ var children = ge.getFeatures().getChildNodes(); for(var i = 0; i &lt; children.getLength(); i++) { var child = children.item(i); if(child.getType() == 'KmlPlacemark') { if(child.getId()== name) child.setVisibility(false); } } } </code></pre> <p>to using this <code>ge.getFeatures().removeChild(child);</code></p> <p>can anyone point me to the right direction on creating a function that will allow me to turn the visibility on/off on demand please.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload