我试图在Cesium中指出珠穆朗玛峰的顶部。昨晚我最有可能的候选人是我借来的代码来进行大地测量到 ecef 的转换(来自 PySatel.coord)。今早复习,看来是对的:
a = 6378.137
b = 6356.7523142
esq = 6.69437999014 * 0.001
e1sq = 6.73949674228 * 0.001
f = 1 / 298.257223563
def geodetic2ecef(lat, lon, alt):
"""Convert geodetic coordinates to ECEF.
Units are degrees and kilometers.
"""
lat, lon = radians(lat), radians(lon)
xi = sqrt(1 - esq * sin(lat))
x = (a / xi + alt) * cos(lat) * cos(lon)
y = (a / xi + alt) * cos(lat) * sin(lon)
z = (a / xi * (1 - esq) + alt) * sin(lat)
return x, y, z
我从维基百科中提取了珠穆朗玛峰顶峰的纬度/经度/纬度。在将对象定位到我的 CZML 之前,我将上述代码提供的 ECF 坐标乘以 1000(m/km)。我得到一个 ECF 位置:[302995.41122130124、5640733.98308375、2981975.8695256836]。使用默认的地形提供者(在教程中描述),这一点明显高于珠穆朗玛峰的峰值。
这是相关的 CZML 片段:
{"position":
{"cartesian": [302995.41122130124, 5640733.98308375, 2981975.8695256836]},
"id": "ellipsoid-1",
"ellipsoid":
{
"radii": {"cartesian": [3545.5375159540376,
164.44985193756034,
164.62702908803794]},
"material": {"solidColor": {"color": {"rgba": [0, 255, 0, 100]}}}
},
"orientation": {"unitQuaternion": [0.00014107125875577922,
-0.011462389405915903,
-0.010254110199791062,
-0.70702315200093502]}
}