javascript - 谷歌地图叠加更新技术

标签 javascript google-maps google-maps-api-3

我在 map 上有一个圆圈需要更新,这是一种方法:

circleopts.radius=100*distance;
// delete old circle overlay
circle.setMap(null);
// create new circle overlay
circle = new google.maps.Circle(circleopts);
// display new circle overlay
circle.setMap(map);

出于某种原因,我觉得这不太优雅。这是最好的方法吗?

最佳答案

根据the documentation ,你应该能够做到这一点

circle.setOptions( circleopts );

关于javascript - 谷歌地图叠加更新技术,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3925632/

相关文章:

javascript - 在 asp.net 中单击按钮时调用 jQuery 函数

javascript - 导出带有标题(包括图像)的 Excel

javascript - 我的 Google map JavaScript 未加载

css - 响应式 iframe(谷歌地图)和奇怪的调整大小

multithreading - 在网络 worker 中使用谷歌地图对象?

javascript - 通过缩放调整自定义图像标记的大小 - Google Maps API v3

javascript - 如何使返回 Promise 的函数在 forEach 循环内正常工作?

javascript - Redux - Hooks : Using React Hooks with Redux Hooks, 创建无限循环或根本不创建任何内容

ios - CLLocationManager 委托(delegate)方法没有被调用(谷歌地图已集成)

javascript - 谷歌地图 - 点击按钮触发搜索框