简体   繁体   English

刷新标记-Google Maps JavaScript API v3

[英]refresh markers - Google Maps JavaScript API v3

i'm refreshing an array of markers every 5 seconds using the setInterval function. 我使用setInterval函数每5秒钟刷新一次标记数组。 I need to compare the two arrays (before/after the refresh) in order to select which markers will be added (or removed) to the map. 我需要比较两个数组(刷新之前/之后),以便选择将哪些标记添加(或删除)到地图。 Is there any efficent way to do it (beyond the classical approach of two chained for loops)? 有什么有效的方法(除了两个链式for循环的经典方法之外)?

Deleting all markers before the refresh is automatically closing the infowindow (which is not desirable). 在刷新之前删除所有标记会自动关闭信息窗口(这是不希望的)。

thanks 谢谢

请参考此讨论JavaScript数组的区别 。我认为Joshaven Potters的答案为您提供了解决方案。

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

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