I’m having trouble getting the setMap(null); function that everyone seems to be recommending to work.
I believe it may be a problem with the way I’ve implemented the markers.
If someone could take a look and let me know if you see something wrong I’d greatly appreciate it.
LINK: http://www.dougglover.com/samples/UOITMap/v2/
Please Note: Old link above, doesn’t go anywhere.
The basic problem is that if you want this to work you’ve got to make up your mind about what the
markersTestobject is supposed to hold. You can’t seem to decide whether the elements inmarkersTestshould be markers or should be arrays that tell you about where markers are going to be placed.Quoting from your javascript file, here are the two functions that get executed when you check/clear the checkbox:
For
addTestMarkersto work, themarkersTestobject needs to hold descriptions of where the markers should go. ForclearOverlaysto work, themarkersTestobject needs to hold markers.Here’s my suggestion: change the
markersTestobject as you set it up at the top of the javascript file tomarkerDestinations, and at the top of the javascript file havemarkersTestinitialized with:Then, modify
addTestMarkersto:The key change is to make
addTestMarkersactually put the markers into themarkersTestobject.