I have overlays that are not added on the page load but added when a
user clicks a link. However this method of hiding the buttons won't
work, do you know why? Here is my code and you can see my page here
http://alpha.clickablecommunity.com/

        //this function takes in the lat lon and description.
        //it checks an array of coordinates and if the coordinates
        //are in the array then it removes the marker.
        //if they are not in the array then we add them to
        //the array and add the marker. keeping the coordinates
        //in an array is how I check to see if the marker exists.
        function addUserMarker(lat, lon, desc) {

            //a string version of our coordinates
            //to check the array of coordinates with
            var tempCord = lat.toString() + lon.toString();

            //we set this to false if it stays that way
            //then the coordinates are not in the array
            //meaning it's not on the map so we add it
            var inMap = false;

            var count = 0;

            //create the new marker
            var tempMarker = new GMarker(new GLatLng(lat, lon));

            while (inMap == false && count < arrOfCord.length) {

                //if it is in the array then the coordinate is already
                //a marker on the map
                if (tempCord == arrOfCord[count]) {

                    inMap = true;

                } //it tempCord

                count++;

            } //while

            //if this stayed false then we add it to the map
            if (inMap == false) {
                arrOfCord.push(tempCord);

                //add the description popup box
                GEvent.addListener(tempMarker, "click", function() {
                    tempMarker.openInfoWindowHtml(desc);
                });

                map.addOverlay(tempMarker);
                map.setCenter(new GLatLng(lat, lon), map.getZoom());
            } //if inMap

            //we need to remove the marker
            else {

                //remove the marker from the map
                tempMarker.hide();

                //remove it from the array
                arrOfCord.splice(arrOfCord.indexOf(tempCord), 1);

            } //else

        } //addUserMarker

Keep in mind I am developing this site so it's not always up.

On Aug 6, 12:11 pm, Grok Lobster <[email protected]> wrote:
> Mike Williams' tutorial,http://econym.org.uk/gmap/example_categories.htm
>
> On Aug 6, 10:03 am, "Dr. Dot" <[email protected]> wrote:
>
> > Does anyone has a code snipit or a link to a map that handles on/off
> > toggling of multiple overlays on a map?
>
> > I am not sure how to name or id an overlay using map.addOverlay() and
> > map.removeOverlay().
>
> > Thanks.

--~--~---------~--~----~------------~-------~--~----~
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