有什么简单的方法可以清除Google Maps v3 API上的所有标记,折线和其他叠加层? [英] Any simple way to clean all Markers, Polylines and other Overlays on Google Maps v3 API?

查看:74
本文介绍了有什么简单的方法可以清除Google Maps v3 API上的所有标记,折线和其他叠加层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取不使用刷新网页的新地图.

I want to get a new map not using refush the webpage.

谢谢

有简单的方法在地图上获取所有叠加层吗?

and has easy way to get all Overlays on the map?

推荐答案

在v2 API中,存在 Gaby指出了.但是,如果使用v3 API,则不存在此方法.如果我没记错的话,这种遗漏是为了使库保持轻量级.

In the v2 API, there was the clearOverlays() method as Gaby pointed out. However, this method is not present if the v3 API. If I remember correctly, this omission was intentional to keep the library lightweight.

因此,使用v3 API,您必须保留叠加层的引用,然后在每个叠加层上调用setMap(null).

Therefore, with the v3 API, you have to keep a reference of your overlays, and then call setMap(null) on each overlay.

这篇关于有什么简单的方法可以清除Google Maps v3 API上的所有标记,折线和其他叠加层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆