我以(lat,lon)为圆心。
我的半径R以公里为单位。
我的代码
for (var i = 0; i < steps; i++) {
let degrees = (i/steps)*360
let radians = (Math.PI/180)*degrees
let x = lat + radius * Math.cos(radians)
let y = lon + radius * Math.sin(radians)
coordinates.push([x,y])
}
返回椭圆形,因为纬度和可变半径不是以km为单位,而是以坐标为单位。
如何修改此代码以生成一个完美的圆?