小编kar*_*ank的帖子

如何更改 Google Map API 中标记周围圆圈的半径

我试图通过更改组合菜单的值来更改圆半径。所以我为 onchange 编写了一个函数,如下所示。

    function changeRadius(){ 
       var selectedRadius = (document.getElementById("circle_radius").value)*1000;

       var circle = new google.maps.Circle({
              map: map,
              radius: selectedRadius // radius unit is meter.
            });

       var marker2 = new google.maps.Marker({
              map: map,
              position: new google.maps.LatLng(40,-90),
              draggable: true,
              title: 'Drag me!'
            });

       circle1.bindTo('center', marker2, 'position'); 

   }
Run Code Online (Sandbox Code Playgroud)

但这不起作用。任何想法?

javascript api google-maps

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

api ×1

google-maps ×1

javascript ×1