Google maps api 3 google.maps.Circle类中的getPath函数

Google maps api 3 google.maps.Circle类中的getPath函数,google-maps-api-3,Google Maps Api 3,google.maps.Circle类中没有任何getPath()函数。如何使用getRadius()和getCenter()函数获得近似路径?您可以使用该方法计算具有相同半径和中心的圆形多边形的路径(需要库) function circlePath(circle) { var numPts = 512; var path = []; for (var i = 0; i < numPts; i++) { path.push(google.maps.geometry.

google.maps.Circle类中没有任何getPath()函数。如何使用getRadius()和getCenter()函数获得近似路径?

您可以使用该方法计算具有相同半径和中心的圆形多边形的路径(需要库)


function circlePath(circle) {
  var numPts = 512;
  var path = [];
  for (var i = 0; i < numPts; i++) {
    path.push(google.maps.geometry.spherical.computeOffset(circle.getCenter(), circle.getRadius(), i * 360 / numPts));
  }
  return path;
}