コード例 #1
0
void Convert_Local_Cartesian_To_Geodetic (double X,
                                          double Y, 
                                          double Z,
                                          double *Latitude,
                                          double *Longitude,
                                          double *Height)

{ /* BEGIN Convert_Local_Cartesian_To_Geodetic */
/*
 * The function Convert_Local_Cartesian_To_Geodetic converts local cartesian
 * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude, 
 * and height), according to the current ellipsoid and local origin parameters.
 *
 *    X         : Local cartesian X coordinate, in meters    (input)
 *    Y         : Local cartesian Y coordinate, in meters    (input)
 *    Z         : Local cartesian Z coordinate, in meters    (input)
 *    Latitude  : Calculated latitude value, in radians      (output)
 *    Longitude : Calculated longitude value, in radians     (output)
 *    Height    : Calculated height value, in meters         (output)
 */

  double U, V, W;

  Convert_Local_Cartesian_To_Geocentric(X, Y, Z, &U, &V, &W);

  Set_Geocentric_Parameters(LocalCart_a, LocalCart_f);
  Convert_Geocentric_To_Geodetic(U, V, W, Latitude, Longitude, Height);

  if (*Longitude > PI)
    *Longitude -= TWO_PI;
  if (*Longitude < -PI)
    *Longitude += TWO_PI;

} /* END OF Convert_Local_Cartesian_To_Geodetic */
コード例 #2
0
ファイル: pj_transform.c プロジェクト: hminth/Rice-Video
int pj_geocentric_to_geodetic( double a, double es, 
                               long point_count, int point_offset,
                               double *x, double *y, double *z )

{
    double b;
    int    i;

    if( es == 0.0 )
        b = a;
    else
        b = a * sqrt(1-es);

    if( Set_Geocentric_Parameters( a, b ) != 0 )
    {
        pj_errno = PJD_ERR_GEOCENTRIC;
        return pj_errno;
    }

    for( i = 0; i < point_count; i++ )
    {
        long io = i * point_offset;

        Convert_Geocentric_To_Geodetic( x[io], y[io], z[io], 
                                        y+io, x+io, z+io );
    }

    return 0;
}