Python 如何计算坐标系(纬度、经度)中的对角,其中-90<;纬度<;90和-180<;朗<;180
给定一个坐标点X=(lat,lon)和一个圆的中心C=(lat_中心,lon_中心),我想计算点X的对角坐标(假设X在中心为C的圆内) 例如,如果C=(45.9180),X=(45.9,-179)的正对面应该是(45.9179) 以下函数是近似值,但不能解决纬度介于(-90,90)和经度(-180,180)之间的问题Python 如何计算坐标系(纬度、经度)中的对角,其中-90<;纬度<;90和-180<;朗<;180,python,math,coordinates,Python,Math,Coordinates,给定一个坐标点X=(lat,lon)和一个圆的中心C=(lat_中心,lon_中心),我想计算点X的对角坐标(假设X在中心为C的圆内) 例如,如果C=(45.9180),X=(45.9,-179)的正对面应该是(45.9179) 以下函数是近似值,但不能解决纬度介于(-90,90)和经度(-180,180)之间的问题 def f(横向、纵向、中心): 横向中心=中心[0] lon_中心=中心[1] dist_lon=np.abs(lon-lon_center)如果np.abs(lon-lon_c
def f(横向、纵向、中心):
横向中心=中心[0]
lon_中心=中心[1]
dist_lon=np.abs(lon-lon_center)如果np.abs(lon-lon_center)将从点到圆中心的路径添加到圆坐标
C=(0,0)
X=(1,1)
C-X=(-1,-1)#(最终-初始)从X>C的路径
C+(-1,-1)=(-1,-1)使用中的公式和脚本,我们可以:
1)计算从X到C的轴承
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
where
φ1,λ1 is the start point, φ2,λ2 the end point (Δλ is the difference in longitude)
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 ⋅ atan2( √a, √(1−a) )
d = R ⋅ c
where φ is latitude, λ is longitude, R is earth’s radius (mean radius = 6,371km);
note that angles need to be in radians to pass to trig functions!
2)计算从X到C的距离
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
where
φ1,λ1 is the start point, φ2,λ2 the end point (Δλ is the difference in longitude)
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 ⋅ atan2( √a, √(1−a) )
d = R ⋅ c
where φ is latitude, λ is longitude, R is earth’s radius (mean radius = 6,371km);
note that angles need to be in radians to pass to trig functions!
3)使用相同的方向角和加倍的距离,从起点查找给定距离和方向角的目标点
φ2 = asin( sin φ1 ⋅ cos δ + cos φ1 ⋅ sin δ ⋅ cos θ )
λ2 = λ1 + atan2( sin θ ⋅ sin δ ⋅ cos φ1, cos δ − sin φ1 ⋅ sin φ2 )
where φ is latitude, λ is longitude, θ is the bearing (clockwise from north),
δ is the angular distance d/R; d being the distance travelled, R the earth’s radius
(作为变体-获取从C到X的距离和方向角,然后使用θ+Pi
在相反方向上找到具有相同距离的点(不加倍))您希望结果的精度如何,以及C到X的距离有多远?最好的方法是:查找大地坐标库:计算X和C之间的大地坐标的距离和方向,然后应用方向和距离C,得到Y。在较短的距离上,可以使用其他技巧(仅使用球体或笛卡尔坐标)什么是lat
和lon
,角度还是坐标?纬度和经度是坐标这不是标准化纬度在(-90,90)和经度在(-180,180)之间你能解释一下吗?或者这对@Jay有帮助吗?我的答案不清楚吗?