删除Google地图圈子/形状 [英] Removing a Google maps Circle/shape

查看:98
本文介绍了删除Google地图圈子/形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用google.maps.Circle()方法创建了一个Circle。这一切都正常工作,但我怎么能删除所述的圈子?

I am creating a Circle using the google.maps.Circle() method. This all works fine and dandy, but how can I remove said circle?

我的代码:

var populationOptionsAgain = {
  strokeColor: "#c4c4c4",
  strokeOpacity: 0.35,
  strokeWeight: 0,
  fillColor: "#ffffff",
  fillOpacity: 0.35,
  map: map,
  center: results[0].geometry.location,
  radius: 40000
};
cityCircle = new google.maps.Circle(populationOptionsAgain);


推荐答案

您需要调用 setMap 方法将Circle对象设置为null:

You need to call the setMap method on the Circle object to null:

cityCircle.setMap(null);

这篇关于删除Google地图圈子/形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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