views:

176

answers:

3

Hi, does anyone know if it is possible to remove the overlay where I previously drew a polygon? I don't want to use clearOverlays because it will remove all the markers also, instead I want to just hide the markers. Thanks, Richard

A: 

Take a look at the GoogleMaps References:

GoogleMaps References

There you can find the function hide() which should do the job.

mropa
+1  A: 

Yes. Did you keep a reference to the overlay in question? Then just call map.removeOverlay()

http://code.google.com/apis/maps/documentation/reference.html#GMap2

You question could be less conflicted. If you want to hide an overlay, say a marker, do as other poster said, hide() it.

polys are overlays, they are not married to markers, which are overlays as well.

Sky Sanders
I think I know what you mean, and I will try it out when I am home and not typing into my phone.
Richard
A: 

Have you tried the removeOverlay method of the GMap object?

removeOverlay(overlay:GOverlay)

Link to related documentation

You can also just hide a marker without removing it from the map.

Link to related documentation

Stephen Curran