Hi

A page on our website displays a Google map and loads elements (lines,
polygons) from a kml file. Is there a way to hide those elements from
a single click (javascript way)?

I tried map.removeOverlay but no luck...

gx variable is defined inside initialize() function

function initialize() {
...
var gx = new GGeoXml('referenceToMyKMLfile');
map.addOverlay(gx);
...
}

function toggleGeoXML() {
        if (document.getElementById("hideKML").checked) {
                map.removeOverlay(gx);
        }
        else {
                map.addOverlay(gx);
        }
}

Then this checkbox calls the togglrGeoXML() function.

<input type="checkbox" id="hideKML" onclick="toggleGeoXML();">Hide


Obviously the map with those elements read from the KML displays and
"stubbornly" stay on, regardless I check on and off that box a million
times ;-)

All the best
Andrei

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

Reply via email to