我下载了气象数据,它有经度(十进制)、纬度(十进制)和海拔(m)值。没有关于使用的坐标系的信息。如何将其转换为笛卡尔坐标?。我的尝试如下。但是,我的问题是找到正确的公式def cartesian(self,longitude,latitude, elevation):
R = 6378137.0 + elevation # relative to centre of the earth
X = R * math.cos(longitude) * math.sin(latitude)
Y = R * math.sin(longitude) * math.sin(latitude)
Z = R * math.cos(latitude)
def cartesian3(self,longitude,latitude, elevation):
X = longitude * 60 * 1852 * math.cos(latitude)
Y = latitude * 60 * 1852
Z = elevation
return X,Y,Z
Daphna Shezaf的答案here使用不同的公式。但是,它不使用立面。
如果有人能澄清我的困惑,我将不胜感激,是否应该在转换long/lat时使用elevation?。什么是正确的公式?。我试图通过使用特定的long,lat,elev来比较我的代码在这个website上的结果。我以上两种方法的结果与网站上的结果相差甚远
更新
我想分享我的问题的解决方法。我已经在python中以here的形式在Matlab中实现了lla2ecef函数。它允许将弧度经度、纬度和高程(高度以m为单位)转换为笛卡尔坐标。我只需要将经纬度转换为弧度,只要它们是十进制的:latitude = (lat * math.pi) / 180 #latitude in radian, and lat in decimal
来验证我的计算。我将转换结果与上面的网站(website)和this进行了比较。两者给我的结果几乎相同。
注意:如果您认为地球是球体的话,您可以使用def cartesian(我更新了它;感谢Sasha的更正)。如果您认为地球是椭球体(WGS 84大地测量系统),您可以实现lla2ecef中的转换。def cartesian用于地图投影(感谢rodrigo)