我试图在我的Monogame应用程序中放置真正的lat-long建筑物(我学校的4栋建筑物,请用蓝色圆圈检查图像)
但是经过一些转换方法后,它出现了非常错误(请查看图片)
请帮我找出错误。
我的代码:
public List<float> Gps2Cartesian(float latitude_degree, float longitude_degree, float elevation)
{
cartesResult = new List<float>();
var longtitude_rad = DegreeToRadian(longitude_degree);
var latitude_rad = DegreeToRadian(latitude_degree);
var n = a / Math.Sqrt(1 - e2 * Math.Sin(latitude_rad) * Math.Sin(latitude_rad));
var cartes_X = (n + elevation) * Math.Cos(latitude_rad) * Math.Cos(longtitude_rad); //ECEF x (z in right - handed system) (m)
var cartes_Y = (n + elevation) * Math.Cos(latitude_rad) * Math.Sin(longtitude_rad); //ECEF y (x in right - handed system) (m)
var cartes_Z = (n * (1 - e2) + elevation) * Math.Sin(latitude_rad); //ECEF z (y in right-handed system) (m)
cartesResult.Add((float)cartes_Y);
cartesResult.Add((float)cartes_Z);
cartesResult.Add((float)cartes_X);
return cartesResult;
}
这是调试结果:
D3 X:5730549 Y:2271896 Z:-162645005
C2 X:5730621 Y:2272063 Z:-162594705
C9 X:5730595 Y:2272005 Z:-1626123
C1 X:5730521 Y:2272123 Z:-1626228
谢谢!