【问题标题】:Generate circle points from latitude and longitude from center point and radius从中心点和半径生成经纬度圆点
【发布时间】:2019-11-11 18:21:15
【问题描述】:

我有 (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])
}

由于纬度和可变半径不是以公里为单位,而是以坐标为单位,因此返回椭圆形。

如何调整此代码以生成完美的圆?

【问题讨论】:

标签: javascript geometry radius


【解决方案1】:

对于不是很大的圆半径,您可以使用除以cos(latitude) 来校正经度尺寸,因为子午线/平行比取决于此值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多