如何在谷歌地图中画一个圆圈

Abh*_*hek 1 javascript jquery google-maps google-maps-api-3

如果用户有纬度、经度和半径,如何在谷歌地图中的某个位置(中心除外)画一个圆圈?

Gor*_*ard 6

// Create marker 
var marker = new google.maps.Marker({
  map: map,
  position: new google.maps.LatLng(53, -2.5),
  title: 'Some location'
});

// Add circle overlay and bind to marker
var circle = new google.maps.Circle({
  map: map,
  radius: 16093,    // 10 miles in metres
  fillColor: '#AA0000'
});

circle.bindTo('center', marker, 'position');
Run Code Online (Sandbox Code Playgroud)

听起来如果你有你想要的纬度/经度和半径,那么你可以在地图上的某个地方定义一个点,然后在那个点上绑定一个圆。

来源