简体   繁体   English

如何从谷歌地图中删除所有元素

[英]How to remove all element from google map

I have all kind of controls on the map, markers ,infoboxes, infowindows ....我在地图上有各种控件,标记,信息框,信息窗口......

How do i remove them all in order to get a clean map as it was after i created it.我如何将它们全部删除以获得干净的地图,就像我创建它之后一样。

I don't want to re-create the map.我不想重新创建地图。

Store them as you are creating them inside of an array or collection.在数组或集合中创建它们时将它们存储起来。

Then reference that array of objects to clear/delete them.然后引用该对象数组以清除/删除它们。

In your function where you initialize the map, just put this option:在您初始化地图的函数中,只需放置此选项:

var mapOptions = {   
   disableDefaultUI: true
}

More informations here:更多信息在这里:

https://developers.google.com/maps/documentation/javascript/examples/control-disableUI https://developers.google.com/maps/documentation/javascript/examples/control-disableUI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM