我有一些以纬度和经度(WGS-84)表示的地心坐标点。
如何将它们转换为原点位于地球中心的笛卡尔坐标(x,y,z)?
发布于 2019-03-20 16:57:25
在python3.x中,可以使用:
# Converting lat/long to cartesian
import numpy as np
def get_cartesian(lat=None,lon=None):
lat, lon = np.deg2rad(lat), np.deg2rad(lon)
R = 6371 # radius of the earth
x = R * np.cos(lat) * np.cos(lon)
y = R * np.cos(lat) * np.sin(lon)
z = R *np.sin(lat)
return x,y,z
发布于 2017-01-21 16:15:54
发布于 2011-08-05 08:41:23
如果你想获得基于椭球体而不是球体的坐标,可以看看Geographic_coordinate_conversion -它给出了公式。GEodetic Datum具有转换所需的WGS84常量。
其中的公式还考虑了相对于参考椭球曲面的高度(如果您从GPS设备获取高度数据,则非常有用)。
https://stackoverflow.com/questions/1185408
复制相似问题