title: KML layer On/Off for integrated Google Maps 3 & GE application
body: <p>I have a webmap with GMaps &amp; GEarth integrated, in order for the user to switch between different views.</p>
  
  <p>I load 3 KML files and control their visibility using checkboxes. This example here uses the same function <a href="https://stackoverflow.com/questions/10805257/how-to-toggle-between-kml-kmz-layers-in-google-maps-api-v3">stackOverflowQuestion</a></p>
  
  <p>When I switch views Map - Satellite - Earth I have my KMLs working on Map &amp; Satellite view, BUT not on Earth View.</p>
  
  <pre><code>    function init() {
      map = new google.maps.Map(document.getElementById('map'), {
        zoom: 14,
        center: new google.maps.LatLng(xx, xx),
        mapTypeId: google.maps.MapTypeId.TERRAIN
      });
  
      googleEarth = new GoogleEarth(map);
  
      google.maps.event.addListenerOnce(map, 'tilesloaded', addOverlays);
  
      }//end init
  
      [...]
  
      function OnOffKML(i) {
  
      if(currentKmlObjects[i].getMap() === null) {
          currentKmlObjects[i].setMap(map);
      }
      else {
          currentKmlObjects[i].setMap(null);
      }
  }
  </code></pre>
  
  <p>this function works for Google Maps Api 3, but not for Google Earth plugin...
  Does this mean I have to use the fetch{} for it to show on GE? Is there a workaround?</p>
  
  <p>Could I exclude my toggleKML{} for the earth view in any way?</p>