【问题标题】:How can I find the height and width from 2 coordinates of longitude and latitude?如何从经度和纬度的 2 个坐标中找到高度和宽度?
【发布时间】:2022-01-08 09:49:57
【问题描述】:

我在网上查了,但找不到任何结果。我的问题是我有两个点的坐标,如图所示。但我需要找到高度和宽度。我将为 c++ 编写代码,但如果你没有它,你就不需要这样做。如果您能帮我计算公式,我将不胜感激。非常感谢。

【问题讨论】:

    标签: visual-c++ coordinates width formula


    【解决方案1】:

    我找到了答案。

    double lla2flatDistanceFormula(double lat1, double lon1, double lat2, double lon2)
    {
    double psio = 30;
    double href = 0;
    
    const double R = 6378137;
    const double f = 0.00335281066474748071;
    
    // target
    const double lat_p = lat1 * M_PI / 180;
    const double lon_p = lon1 * M_PI / 180;
    const double alt_p = href;
    
    // reference
    const double lat_o = lat2 * M_PI / 180;
    const double lon_o = lon2 * M_PI / 180;
    
    psio = psio * M_PI / 180;
    
    double d_lat = abs(lat_p - lat_o);
    double d_lon = abs(lon_p - lon_o);
    
    double ff = (2.0 * f) - pow(f, 2);
    double sin_lat = sin(lat_o);
    
    double Rn = R / sqrt(1 - (ff * pow(sin_lat, 2)));
    double Rm = Rn * (1 - ff) / (1 - ff * pow(sin_lat, 2));
    
    
    double d_north = d_lat / atan2(1, Rm); //Height metric
    double d_east = d_lon / atan2(1, (Rn * cos(lat_o))); //Width metric
    
     // Rotate matrix clockwise
    double x_p = (d_north * cos(psio)) + d_east * sin(psio);
    double y_p = (-d_north * sin(psio)) + d_east * cos(psio);
    double z_p = -alt_p - href;
    
    double w_p = sqrt(pow(x_p, 2) + pow(y_p, 2));
    
    
    
    return w_p; //point to point distance metric }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-19
      • 1970-01-01
      • 2013-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多