Hi Everyone,

I am trying to add two KML file as overlay to my map but I have
problem with removing them.I tried to modify some code from:
http://greg-koppel.site88.net/maps/DemoKML3.html
But the problem here is the tutorial is trying to create new map for
each checkbox, however I want to have just one map with several
checkbox overlay options which can be add or remove kml layer to map.
Can you please let me know where can I find a sample which add kml as
an overlay which can be remove when the checkbox are Un Checked.

Here is what I was trying to do but as you see I clear all kmls
whenever I un check a chekbox

function showKML1(chk) {
    if(chk.checked == true) {
    myMap = new google.maps.KmlLayer('https://sites.google.com/site/
bgeoca/kmls/States.kmz', {
    map: map    });
    }
  else {
           myMap.setMap(null)
         }
}

function showKML2(chk) {
    if(chk.checked == true) {
    myMap = new google.maps.KmlLayer('https://sites.google.com/site/
bgeoca/kmls/Mines.kmz', {
    map: map
    });
        }
        else {
               myMap.setMap(null)
              }
}
</script>

<form>
<input type=checkbox onClick="showKML2(this)" /> City<br />
<input type=checkbox onClick="showKML1(this)" /> States<br />
</form>
-------------------------------------------------------------------------------------------------

Thanks for you time in advanced

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to