开发者

remove a single overlay in googlemaps

开发者 https://www.devze.com 2022-12-20 02:07 出处:网络
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 wan

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


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.


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


Take a look at the GoogleMaps References:

GoogleMaps References

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

0

精彩评论

暂无评论...
验证码 换一张
取 消