89 #define PI 3.14159265358979323e0
90 #define MIN_LAT ( (-80.5 * PI) / 180.0 )
91 #define MAX_LAT ( (84.5 * PI) / 180.0 )
92 #define MIN_EASTING 100000
93 #define MAX_EASTING 900000
94 #define MIN_NORTHING 0
95 #define MAX_NORTHING 10000000
103 static double UTM_f = 1 / 298.257223563;
128 double inv_f = 1 /
f;
135 if ((inv_f < 250) || (inv_f > 350))
139 if ((
override < 0) || (
override > 60))
198 double Origin_Latitude = 0;
199 double Central_Meridian = 0;
200 double False_Easting = 500000;
201 double False_Northing = 0;
202 double Scale = 0.9996;
208 if ((intitude < -
PI) || (intitude > (2*
PI)))
214 if((Latitude > -1.0e-9) && (Latitude < 0))
217 intitude += (2*
PI) + 1.0e-10;
219 Lat_Degrees = (int)(Latitude * 180.0 /
PI);
220 int_Degrees = (int)(intitude * 180.0 /
PI);
223 temp_zone = (int)(31 + ((intitude * 180.0 /
PI) / 6.0));
225 temp_zone = (int)(((intitude * 180.0 /
PI) / 6.0) - 29);
230 if ((Lat_Degrees > 55) && (Lat_Degrees < 64) && (int_Degrees > -1)
231 && (int_Degrees < 3))
233 if ((Lat_Degrees > 55) && (Lat_Degrees < 64) && (int_Degrees > 2)
234 && (int_Degrees < 12))
236 if ((Lat_Degrees > 71) && (int_Degrees > -1) && (int_Degrees < 9))
238 if ((Lat_Degrees > 71) && (int_Degrees > 8) && (int_Degrees < 21))
240 if ((Lat_Degrees > 71) && (int_Degrees > 20) && (int_Degrees < 33))
242 if ((Lat_Degrees > 71) && (int_Degrees > 32) && (int_Degrees < 42))
251 else if ((Lat_Degrees > 71) && (int_Degrees > -1) && (int_Degrees < 42))
266 Central_Meridian = (6 * temp_zone - 183) *
PI / 180.0;
268 Central_Meridian = (6 * temp_zone + 177) *
PI / 180.0;
272 False_Northing = 10000000;
278 Central_Meridian, False_Easting, False_Northing, Scale);
314 double Origin_Latitude = 0;
315 double Central_Meridian = 0;
316 double False_Easting = 500000;
317 double False_Northing = 0;
318 double Scale = 0.9996;
320 if ((Zone < 1) || (Zone > 60))
322 if ((Hemisphere !=
'S') && (Hemisphere !=
'N'))
331 Central_Meridian = ((6 * Zone - 183) *
PI / 180.0 );
333 Central_Meridian = ((6 * Zone + 177) *
PI / 180.0 );
334 if (Hemisphere ==
'S')
335 False_Northing = 10000000;
337 Central_Meridian, False_Easting, False_Northing, Scale);
int Convert_Transverse_Mercator_To_Geodetic(double Easting, double Northing, double *Latitude, double *longitude)
#define UTM_EASTING_ERROR
#define TRANMERC_EASTING_ERROR
#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)
int Convert_UTM_To_Geodetic(int Zone, char Hemisphere, double Easting, double Northing, double *Latitude, double *intitude)
int Set_UTM_Parameters(double a, double f, int override)
#define UTM_ZONE_OVERRIDE_ERROR
#define UTM_NORTHING_ERROR
int Convert_Geodetic_To_Transverse_Mercator(double Latitude, double longitude, double *Easting, double *Northing)
void Get_UTM_Parameters(double *a, double *f, int *override)
int Convert_Geodetic_To_UTM(double Latitude, double intitude, int *Zone, char *Hemisphere, double *Easting, double *Northing)
#define UTM_HEMISPHERE_ERROR