102 #define PI 3.14159265358979323e0
103 #define PI_OVER_2 (PI/2.0e0)
104 #define MAX_LAT ((PI * 89.99)/180.0)
105 #define MAX_DELTA_int ((PI * 90)/180.0)
106 #define MIN_SCALE_FACTOR 0.3
107 #define MAX_SCALE_FACTOR 3.0
109 #define SPHTMD(Latitude) ((double) (TranMerc_ap * Latitude \
110 - TranMerc_bp * sin(2.e0 * Latitude) + TranMerc_cp * sin(4.e0 * Latitude) \
111 - TranMerc_dp * sin(6.e0 * Latitude) + TranMerc_ep * sin(8.e0 * Latitude) ) )
113 #define SPHSN(Latitude) ((double) (TranMerc_a / sqrt( 1.e0 - TranMerc_es * \
114 pow(sin(Latitude), 2))))
116 #define SPHSR(Latitude) ((double) (TranMerc_a * (1.e0 - TranMerc_es) / \
117 pow(DENOM(Latitude), 3)))
119 #define DENOM(Latitude) ((double) (sqrt(1.e0 - TranMerc_es * pow(sin(Latitude),2))))
163 double Origin_Latitude,
164 double Central_Meridian,
165 double False_Easting,
166 double False_Northing,
193 double dummy_northing;
195 double inv_f = 1 /
f;
202 if ((inv_f < 250) || (inv_f > 350))
210 if ((Central_Meridian < -
PI) || (Central_Meridian > (2*
PI)))
223 if (Central_Meridian >
PI)
224 Central_Meridian -= (2*
PI);
244 + 81.e0 * (tn4 - tn5)/64.e0 );
246 /8.e0 + 55.e0 * tn5/64.e0 )/2.e0;
268 double *Origin_Latitude,
269 double *Central_Meridian,
270 double *False_Easting,
271 double *False_Northing,
272 double *Scale_Factor)
361 longitude -= (2 *
PI);
366 temp_int = longitude + 2 *
PI;
385 if (fabs(dlam) > (9.0 *
PI / 180))
394 if (fabs(dlam) < 2.e-10)
415 sn =
SPHSN(Latitude);
427 + 4.e0 * eta2) /24.e0;
430 + tan4 + 270.e0 * eta - 330.e0 * tan2 * eta + 445.e0 * eta2
431 + 324.e0 * eta3 -680.e0 * tan2 * eta2 + 88.e0 * eta4
432 -600.e0 * tan2 * eta3 - 192.e0 * tan2 * eta4) / 720.e0;
435 tan2 + 543.e0 * tan4 - tan6) / 40320.e0;
438 + pow(dlam,4.e0) * t3 + pow(dlam,6.e0) * t4
439 + pow(dlam,8.e0) * t5;
443 t7 = sn * c3 * TranMerc_Scale_Factor * (1.e0 - tan2 + eta ) /6.e0;
444 t8 = sn * c5 * TranMerc_Scale_Factor * (5.e0 - 18.e0 * tan2 + tan4
445 + 14.e0 * eta - 58.e0 * tan2 * eta + 13.e0 * eta2 + 4.e0 * eta3
446 - 64.e0 * tan2 * eta2 - 24.e0 * tan2 * eta3 )/ 120.e0;
447 t9 = sn * c7 * TranMerc_Scale_Factor * ( 61.e0 - 479.e0 * tan2
448 + 179.e0 * tan4 - tan6 ) /5040.e0;
451 + pow(dlam,5.e0) * t8 + pow(dlam,7.e0) * t9;
527 for (i = 0; i < 5 ; i++)
531 ftphi = ftphi + (tmd - t10) / sr;
552 if (fabs(de) < 0.0001)
557 t11 = t * (5.e0 + 3.e0 * tan2 + eta - 4.e0 * pow(eta,2)
558 - 9.e0 * tan2 * eta) / (24.e0 * sr * pow(sn,3)
560 t12 = t * (61.e0 + 90.e0 * tan2 + 46.e0 * eta + 45.E0 * tan4
561 - 252.e0 * tan2 * eta - 3.e0 * eta2 + 100.e0
562 * eta3 - 66.e0 * tan2 * eta2 - 90.e0 * tan4
563 * eta + 88.e0 * eta4 + 225.e0 * tan4 * eta2
564 + 84.e0 * tan2* eta3 - 192.e0 * tan2 * eta4)
566 t13 = t * ( 1385.e0 + 3633.e0 * tan2 + 4095.e0 * tan4 + 1575.e0
568 *Latitude = ftphi - pow(de,2) * t10 + pow(de,4) * t11 - pow(de,6) * t12
573 t15 = (1.e0 + 2.e0 * tan2 + eta) / (6.e0 * pow(sn,3) * c *
576 t16 = (5.e0 + 6.e0 * eta + 28.e0 * tan2 - 3.e0 * eta2
577 + 8.e0 * tan2 * eta + 24.e0 * tan4 - 4.e0
578 * eta3 + 4.e0 * tan2 * eta2 + 24.e0
579 * tan2 * eta3) / (120.e0 * pow(sn,5) * c
582 t17 = (61.e0 + 662.e0 * tan2 + 1320.e0 * tan4 + 720.e0
583 * pow(t,6)) / (5040.e0 * pow(sn,7) * c
587 dlam = de * t14 - pow(de,3) * t15 + pow(de,5) * t16 - pow(de,7) * t17;
592 if((fabs)(*Latitude) > (90.0 *
PI / 180.0))
595 if((*longitude) > (
PI))
597 *longitude -= (2 *
PI);
598 if((fabs)(*longitude) >
PI)
601 else if((*longitude) < (-
PI))
603 *longitude += (2 *
PI);
604 if((fabs)(*longitude) >
PI)
608 if (fabs(dlam) > (9.0 *
PI / 180) * cos(*Latitude))
#define TRANMERC_ORIGIN_LAT_ERROR
int Convert_Transverse_Mercator_To_Geodetic(double Easting, double Northing, double *Latitude, double *longitude)
static double TranMerc_False_Easting
#define TRANMERC_LON_WARNING
#define TRANMERC_EASTING_ERROR
static double TranMerc_False_Northing
static double TranMerc_Delta_Easting
#define TRANMERC_NORTHING_ERROR
int Set_Transverse_Mercator_Parameters(double a, double f, double Origin_Latitude, double Central_Meridian, double False_Easting, double False_Northing, double Scale_Factor)
#define TRANMERC_SCALE_FACTOR_ERROR
#define TRANMERC_LON_ERROR
static double TranMerc_es
static double TranMerc_cp
#define TRANMERC_NO_ERROR
static double TranMerc_Origin_int
static double TranMerc_ebs
static double TranMerc_Delta_Northing
#define TRANMERC_INV_F_ERROR
int Convert_Geodetic_To_Transverse_Mercator(double Latitude, double longitude, double *Easting, double *Northing)
#define TRANMERC_LAT_ERROR
static double TranMerc_Origin_Lat
static double TranMerc_ep
static double TranMerc_ap
static double TranMerc_bp
#define TRANMERC_CENT_MER_ERROR
void Get_Transverse_Mercator_Parameters(double *a, double *f, double *Origin_Latitude, double *Central_Meridian, double *False_Easting, double *False_Northing, double *Scale_Factor)
static double TranMerc_Scale_Factor
static double TranMerc_dp