将经度和纬度转换为ECEF坐标系 [英] Convert latitude and longitude to ECEF coordinates system

查看:1773
本文介绍了将经度和纬度转换为ECEF坐标系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习算法:



如果您需要进一步的参考资料,可以找到它们在底部那个维基百科页面。你也可以参考 1984年世界大地测量系统的规范。


I am studying pArk Apple sample code, and how it is works. anyone knows how convert the latitude and longitude to ECEF coordinates, and Covert ECEF to ENU coordinates centered at given lat, lon functions are work? I just want to understand what is going on in this function!

thanks.

void latLonToEcef(double lat, double lon, double alt, double *x, double *y, double *z)
{   
    double clat = cos(lat * DEGREES_TO_RADIANS);
    double slat = sin(lat * DEGREES_TO_RADIANS);
    double clon = cos(lon * DEGREES_TO_RADIANS);
    double slon = sin(lon * DEGREES_TO_RADIANS);

    double N = WGS84_A / sqrt(1.0 - WGS84_E * WGS84_E * slat * slat);

    *x = (N + alt) * clat * clon;
    *y = (N + alt) * clat * slon;
    *z = (N * (1.0 - WGS84_E * WGS84_E) + alt) * slat;
}
// Coverts ECEF to ENU coordinates centered at given lat, lon
void ecefToEnu(double lat, double lon, double x, double y, double z, double xr, double yr, double zr, double *e, double *n, double *u)
{
    double clat = cos(lat * DEGREES_TO_RADIANS);
    double slat = sin(lat * DEGREES_TO_RADIANS);
    double clon = cos(lon * DEGREES_TO_RADIANS);
    double slon = sin(lon * DEGREES_TO_RADIANS);
    double dx = x - xr;
    double dy = y - yr;
    double dz = z - zr;

    *e = -slon*dx  + clon*dy;
    *n = -slat*clon*dx - slat*slon*dy + clat*dz;
    *u = clat*clon*dx + clat*slon*dy + slat*dz;
}

解决方案

The latLonToEcef method is an implementation of the algorithm outlined in the Conversion calculations - Geodetic to/from ECEF coordinates wikipedia page:

where

Φ is latitude, λ is longitude, and

Likewise the ecefToEnu method is an implementation of the ECEF to ENU algorithm:

If you need further references, they can be found at the bottom of that Wikipedia page. You might also refer to the World Geodetic System 1984 spec.

这篇关于将经度和纬度转换为ECEF坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆