26 #define UTM_NO_ERROR 0x0000 27 #define UTM_LAT_ERROR 0x0001 28 #define UTM_LON_ERROR 0x0002 29 #define UTM_EASTING_ERROR 0x0004 30 #define UTM_NORTHING_ERROR 0x0008 31 #define UTM_ZONE_ERROR 0x0010 32 #define UTM_HEMISPHERE_ERROR 0x0020 33 #define UTM_ZONE_OVERRIDE_ERROR 0x0040 34 #define UTM_A_ERROR 0x0080 35 #define UTM_B_ERROR 0x0100 36 #define UTM_A_LESS_B_ERROR 0x0200 38 #define MIN_LAT ( (-80.5 * M_PI) / 180.0 ) 39 #define MAX_LAT ( (84.5 * M_PI) / 180.0 ) 40 #define MAX_DELTA_LONG ((M_PI * 90.0)/180.0) 41 #define MIN_EASTING 100000 42 #define MAX_EASTING 900000 43 #define MIN_NORTHING 0 44 #define MAX_NORTHING 10000000 45 #define MIN_SCALE_FACTOR 0.3 46 #define MAX_SCALE_FACTOR 3.0 48 #define SPHTMD(Latitude) ((double) (theTranMerc_ap * Latitude \ 49 - theTranMerc_bp * sin(2.e0 * Latitude) + theTranMerc_cp * sin(4.e0 * Latitude) \ 50 - theTranMerc_dp * sin(6.e0 * Latitude) + theTranMerc_ep * sin(8.e0 * Latitude) ) ) 52 #define SPHSN(Latitude) ((double) (getA() / sqrt( 1.e0 - theTranMerc_es * \ 53 pow(sin(Latitude), 2)))) 55 #define SPHSR(Latitude) ((double) (getA() * (1.e0 - theTranMerc_es) / \ 56 pow(DENOM(Latitude), 3))) 58 #define DENOM(Latitude) ((double) (sqrt(1.e0 - theTranMerc_es * pow(sin(Latitude),2)))) 65 theTranMerc_a(6378137.0),
66 theTranMerc_f(1.0/298.257223563),
67 theTranMerc_es(0.0066943799901413800),
68 theTranMerc_ebs(0.0067394967565869),
69 theTranMerc_Origin_Lat(0.0),
70 theTranMerc_Origin_Long(0.0),
71 theTranMerc_False_Northing(0.0),
72 theTranMerc_False_Easting(500000.0),
73 theTranMerc_Scale_Factor(0.9996),
74 theTranMerc_ap(6367449.1458008),
75 theTranMerc_bp(16038.508696861),
76 theTranMerc_cp(16.832613334334),
77 theTranMerc_dp(0.021984404273757),
78 theTranMerc_Delta_Easting(40000000.0),
79 theTranMerc_Delta_Northing(40000000.0),
95 theTranMerc_a(6378137.0),
96 theTranMerc_f(1.0/298.257223563),
97 theTranMerc_es(0.0066943799901413800),
98 theTranMerc_ebs(0.0067394967565869),
99 theTranMerc_Origin_Lat(0.0),
100 theTranMerc_Origin_Long(0.0),
101 theTranMerc_False_Northing(0.0),
102 theTranMerc_False_Easting(500000.0),
103 theTranMerc_Scale_Factor(0.9996),
104 theTranMerc_ap(6367449.1458008),
105 theTranMerc_bp(16038.508696861),
106 theTranMerc_cp(16.832613334334),
107 theTranMerc_dp(0.021984404273757),
108 theTranMerc_Delta_Easting(40000000.0),
109 theTranMerc_Delta_Northing(40000000.0),
111 theHemisphere(hemisphere)
121 theTranMerc_a(6378137.0),
122 theTranMerc_f(1.0/298.257223563),
123 theTranMerc_es(0.0066943799901413800),
124 theTranMerc_ebs(0.0067394967565869),
125 theTranMerc_Origin_Lat(0.0),
126 theTranMerc_Origin_Long(0.0),
127 theTranMerc_False_Northing(0.0),
128 theTranMerc_False_Easting(500000.0),
129 theTranMerc_Scale_Factor(0.9996),
130 theTranMerc_ap(6367449.1458008),
131 theTranMerc_bp(16038.508696861),
132 theTranMerc_cp(16.832613334334),
133 theTranMerc_dp(0.021984404273757),
134 theTranMerc_Delta_Easting(40000000.0),
135 theTranMerc_Delta_Northing(40000000.0),
145 theTranMerc_a(src.theTranMerc_a),
146 theTranMerc_f(src.theTranMerc_f),
147 theTranMerc_es(src.theTranMerc_es),
148 theTranMerc_ebs(src.theTranMerc_ebs),
149 theTranMerc_Origin_Lat(src.theTranMerc_Origin_Lat),
150 theTranMerc_Origin_Long(src.theTranMerc_Origin_Long),
151 theTranMerc_False_Northing(src.theTranMerc_False_Northing),
152 theTranMerc_False_Easting(src.theTranMerc_False_Easting),
153 theTranMerc_Scale_Factor(src.theTranMerc_Scale_Factor),
154 theTranMerc_ap(src.theTranMerc_ap),
155 theTranMerc_bp(src.theTranMerc_bp),
156 theTranMerc_cp(src.theTranMerc_cp),
157 theTranMerc_dp(src.theTranMerc_dp),
158 theTranMerc_Delta_Easting(src.theTranMerc_Delta_Easting),
159 theTranMerc_Delta_Northing(src.theTranMerc_Delta_Northing),
160 theZone(src.theZone),
161 theHemisphere(src.theHemisphere)
173 double falseNorthing = 10000000.0;
207 double easting = 0.0;
208 double northing = 0.0;
261 if( (zone < 1) || (zone > 60) )
277 char hemisphere = ground.
latd()<0.0?
'S':
'N';
283 hemisphere = toupper(hemisphere);
284 if((hemisphere !=
'N') &&
308 double longitude = ground.
lonr();
312 if (longitude <
M_PI)
313 result = (
ossim_int32)( (31 + ((180 * longitude) / (6 *
M_PI)) ) + 0.00000005);
315 result = (
ossim_int32)( (((180 * longitude) / (6 *
M_PI)) - 29) + 0.00000005);
319 if ((lat_Degrees > 55) && (lat_Degrees < 64) && (long_Degrees > -1)
320 && (long_Degrees < 3))
322 if ((lat_Degrees > 55) && (lat_Degrees < 64) && (long_Degrees > 2)
323 && (long_Degrees < 12))
325 if ((lat_Degrees > 71) && (long_Degrees > -1) && (long_Degrees < 9))
327 if ((lat_Degrees > 71) && (long_Degrees > 8) && (long_Degrees < 21))
329 if ((lat_Degrees > 71) && (long_Degrees > 20) && (long_Degrees < 33))
331 if ((lat_Degrees > 71) && (long_Degrees > 32) && (long_Degrees < 42))
339 return (6.0 * zone - 183.0);;
416 double Origin_Latitude,
417 double Central_Meridian,
418 double False_Easting,
419 double False_Northing,
446 double dummy_northing;
495 + 81.e0 * (tn4 - tn5)/64.e0 );
497 /8.e0 + 55.e0 * tn5/64.e0 )/2.e0;
510 if (Central_Meridian >
M_PI)
511 Central_Meridian -=
TWO_PI;
523 double *Origin_Latitude,
524 double *Central_Meridian,
525 double *False_Easting,
526 double *False_Northing,
527 double *Scale_Factor)
const 561 double *Northing)
const 616 if (Longitude >
M_PI)
650 if (fabs(dlam) < 2.e-10)
671 sn =
SPHSN(Latitude);
683 + 4.e0 * eta2) /24.e0;
686 + tan4 + 270.e0 * eta - 330.e0 * tan2 * eta + 445.e0 * eta2
687 + 324.e0 * eta3 -680.e0 * tan2 * eta2 + 88.e0 * eta4
688 -600.e0 * tan2 * eta3 - 192.e0 * tan2 * eta4) / 720.e0;
691 tan2 + 543.e0 * tan4 - tan6) / 40320.e0;
694 + pow(dlam,4.e0) * t3 + pow(dlam,6.e0) * t4
695 + pow(dlam,8.e0) * t5;
701 + 14.e0 * eta - 58.e0 * tan2 * eta + 13.e0 * eta2 + 4.e0 * eta3
702 - 64.e0 * tan2 * eta2 - 24.e0 * tan2 * eta3 )/ 120.e0;
704 + 179.e0 * tan4 - tan6 ) /5040.e0;
707 + pow(dlam,5.e0) * t8 + pow(dlam,7.e0) * t9;
716 double *Longitude)
const 783 for (i = 0; i < 5 ; i++)
787 ftphi = ftphi + (tmd - t10) / sr;
809 if (fabs(de) < 0.0001)
814 t11 = t * (5.e0 + 3.e0 * tan2 + eta - 4.e0 * pow(eta,2)
815 - 9.e0 * tan2 * eta) / (24.e0 * sr * pow(sn,3)
817 t12 = t * (61.e0 + 90.e0 * tan2 + 46.e0 * eta + 45.E0 * tan4
818 - 252.e0 * tan2 * eta - 3.e0 * eta2 + 100.e0
819 * eta3 - 66.e0 * tan2 * eta2 - 90.e0 * tan4
820 * eta + 88.e0 * eta4 + 225.e0 * tan4 * eta2
821 + 84.e0 * tan2* eta3 - 192.e0 * tan2 * eta4)
823 t13 = t * ( 1385.e0 + 3633.e0 * tan2 + 4095.e0 * tan4 + 1575.e0
825 *Latitude = ftphi - pow(de,2) * t10 + pow(de,4) * t11 - pow(de,6) * t12
830 t15 = (1.e0 + 2.e0 * tan2 + eta) / (6.e0 * pow(sn,3) * c *
833 t16 = (5.e0 + 6.e0 * eta + 28.e0 * tan2 - 3.e0 * eta2
834 + 8.e0 * tan2 * eta + 24.e0 * tan4 - 4.e0
835 * eta3 + 4.e0 * tan2 * eta2 + 24.e0
836 * tan2 * eta3) / (120.e0 * pow(sn,5) * c
839 t17 = (61.e0 + 662.e0 * tan2 + 1320.e0 * tan4 + 720.e0
840 * pow(t,6)) / (5040.e0 * pow(sn,7) * c
844 dlam = de * t14 - pow(de,3) * t15 + pow(de,5) * t16 - pow(de,7) * t17;
850 *Latitude =
M_PI - *Latitude;
852 if (*Longitude >
M_PI)
858 *Latitude = - (*Latitude +
M_PI);
860 if (*Longitude >
M_PI)
865 if (*Longitude < -
M_PI)
878 out << setiosflags(ios::fixed) << setprecision(15)
879 <<
"// ossimUtmProjection::print" ossim_uint32 getCodeFromUtmProj(const ossimUtmProjection *proj) const
Given UTM projection, derives the associated EPSG code. This is faster than a Db lookup.
virtual ossimGpt inverse(const ossimDpt &eastingNorthing) const
Will take a point in meters and convert it to ground.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossim_uint32 getPcsCode() const
Returns the EPSG PCS code based on datum, zone, and hemisphere.
double theTranMerc_Scale_Factor
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.
static ossimString upcase(const ossimString &aString)
virtual double getFalseEasting() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
double lond() const
Will convert the radian measure to degrees.
ossim_int32 Convert_Transverse_Mercator_To_Geodetic(double Easting, double Northing, double *Latitude, double *Longitude) const
The function Convert_Transverse_Mercator_To_Geodetic converts Transverse Mercator projection (easting...
Represents serializable keyword/value map.
double theTranMerc_False_Easting
const char * find(const char *key) const
double theTranMerc_Delta_Northing
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
virtual const ossimString & code() const
virtual void setOrigin(const ossimGpt &origin)
This will set the utm zone and utm origin base on origin passed in.
double theTranMerc_Origin_Lat
double latd() const
Will convert the radian measure to degrees.
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
virtual ossimDpt forward(const ossimGpt &latLon) const
All map projections will convert the world coordinate to an easting northing (Meters).
const ossimDatum * datum() const
datum().
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * ZONE_KW
void Get_Transverse_Mercator_Parameters(double *a, double *f, double *Origin_Latitude, double *Central_Meridian, double *False_Easting, double *False_Northing, double *Scale_Factor) const
The function Get_Transverse_Mercator_Parameters returns the current ellipsoid and Transverse Mercator...
virtual bool operator==(const ossimProjection &projection) const
Compares this to arg projection and returns TRUE if the same.
static ossimEpsgProjectionDatabase * instance()
Instantiates singleton instance of this class:
const double & getA() const
virtual ossimGpt origin() const
double lonr() const
Returns the longitude in radian measure.
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
double theTranMerc_Origin_Long
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual double getFalseNorthing() const
static ossim_int32 computeZone(const ossimGpt &gpt)
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
void setZone(const ossimGpt &ground)
static const char * HEMISPHERE_KW
double latr() const
latr().
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
ossim_int32 getZone() const
ossim_int32 Convert_Geodetic_To_Transverse_Mercator(double Latitude, double Longitude, double *Easting, double *Northing) const
The function Convert_Geodetic_To_Transverse_Mercator converts geodetic (latitude and longitude) coord...
const double & getFlattening() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
ossimUtmProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
char theHemisphere
can be N or S.
ossimEllipsoid theEllipsoid
This method verifies that the projection parameters match the current pcs code.
#define RTTI_DEF1(cls, name, b1)
char getHemisphere() const
ossimDpt theFalseEastingNorthing
Hold the false easting northing.
double theTranMerc_Delta_Easting
static double computeZoneMeridian(ossim_int32 zone)
Return in decimal degrees the zone meridian.
void setHemisphere(const ossimGpt &ground)
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.
virtual bool operator==(const ossimProjection &projection) const
Returns TRUE if principal parameters are within epsilon tolerance.
virtual ossimObject * dup() const
std::basic_ostream< char > ostream
Base class for char output streams.
ossim_int32 Set_Transverse_Mercator_Parameters(double a, double f, double Origin_Latitude, double Central_Meridian, double False_Easting, double False_Northing, double Scale_Factor)
The function Set_Tranverse_Mercator_Parameters receives the ellipsoid parameters and Tranverse Mercat...
double theTranMerc_False_Northing
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.