OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ossimUtmProjection Class Reference

#include <ossimUtmProjection.h>

Inheritance diagram for ossimUtmProjection:
ossimMapProjection ossimProjection ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimUtmProjection (const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
 
 ossimUtmProjection (const ossimEllipsoid &ellipsoid, const ossimGpt &origin, ossim_int32 zone, char hemisphere)
 
 ossimUtmProjection (ossim_int32 zone)
 
 ossimUtmProjection (const ossimUtmProjection &src)
 
virtual ossimObjectdup () const
 
virtual ossimGpt inverse (const ossimDpt &eastingNorthing) const
 Will take a point in meters and convert it to ground. More...
 
virtual ossimDpt forward (const ossimGpt &latLon) const
 All map projections will convert the world coordinate to an easting northing (Meters). More...
 
virtual void update ()
 
virtual void setOrigin (const ossimGpt &origin)
 This will set the utm zone and utm origin base on origin passed in. More...
 
void setZone (const ossimGpt &ground)
 
void setZone (ossim_int32 zone)
 
void setHemisphere (const ossimGpt &ground)
 
void setHemisphere (char hemisphere)
 
ossim_int32 getZone () const
 
char getHemisphere () const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual std::ostream & print (std::ostream &out) const
 Prints data members to stream. More...
 
virtual double getFalseEasting () const
 
virtual double getFalseNorthing () const
 
virtual bool operator== (const ossimProjection &projection) const
 Returns TRUE if principal parameters are within epsilon tolerance. More...
 
virtual ossim_uint32 getPcsCode () const
 Returns the EPSG PCS code based on datum, zone, and hemisphere. More...
 
- Public Member Functions inherited from ossimMapProjection
 ossimMapProjection (const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
 
 ossimMapProjection (const ossimMapProjection &src)
 
virtual ossimGpt origin () const
 
virtual ossimDpt worldToLineSample (const ossimGpt &worldPoint) const
 
virtual void worldToLineSample (const ossimGpt &worldPoint, ossimDpt &lineSample) const
 
virtual ossimGpt lineSampleToWorld (const ossimDpt &projectedPoint) const
 
virtual void lineSampleToWorld (const ossimDpt &projectedPoint, ossimGpt &gpt) const
 
virtual void lineSampleHeightToWorld (const ossimDpt &lineSampPt, const double &heightAboveEllipsoid, ossimGpt &worldPt) const
 This is the pure virtual that projects the image point to the given elevation above ellipsoid, thereby bypassing reference to a DEM. More...
 
virtual void lineSampleToEastingNorthing (const ossimDpt &liineSample, ossimDpt &eastingNorthing) const
 
virtual void eastingNorthingToLineSample (const ossimDpt &eastingNorthing, ossimDpt &lineSample) const
 
virtual void eastingNorthingToWorld (const ossimDpt &eastingNorthing, ossimGpt &worldPt) const
 
virtual double getStandardParallel1 () const
 Derived classes should implement as needed. More...
 
virtual double getStandardParallel2 () const
 Derived classes should implement as needed. More...
 
virtual void setPcsCode (ossim_uint32 pcsCode)
 
virtual ossimString getProjectionName () const
 Returns the projection name. More...
 
virtual double getA () const
 ACCESS METHODS: More...
 
virtual double getB () const
 
virtual double getF () const
 
virtual ossimDpt getMetersPerPixel () const
 
virtual const ossimDptgetDecimalDegreesPerPixel () const
 Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing latitude. More...
 
virtual const ossimDptgetUlEastingNorthing () const
 
virtual const ossimGptgetUlGpt () const
 
virtual const ossimDatumgetDatum () const
 
const ossimEllipsoidgetEllipsoid () const
 
const ossimGptgetOrigin () const
 
virtual bool isGeographic () const
 
virtual void applyScale (const ossimDpt &scale, bool recenterTiePoint)
 Applies scale to theDeltaLonPerPixel, theDeltaLatPerPixel and theMetersPerPixel data members (eg: theDeltaLonPerPixel *= scale.x). More...
 
virtual void setEllipsoid (const ossimEllipsoid &ellipsoid)
 SET METHODS: More...
 
virtual void setAB (double a, double b)
 
virtual void setDatum (const ossimDatum *datum)
 Sets theDatum to datum. More...
 
virtual void setMetersPerPixel (const ossimDpt &gsd)
 
virtual void setDecimalDegreesPerPixel (const ossimDpt &gsd)
 
virtual void setUlTiePoints (const ossimGpt &gpt)
 
virtual void setUlTiePoints (const ossimDpt &eastingNorthing)
 
virtual void setUlEastingNorthing (const ossimDpt &ulEastingNorthing)
 
virtual void setUlGpt (const ossimGpt &ulGpt)
 
virtual void assign (const ossimProjection &aProjection)
 
virtual void computeDegreesPerPixel ()
 Computes the approximate resolution in degrees/pixel. More...
 
virtual void computeMetersPerPixel ()
 This will go from the ground point and give you an approximate meters per pixel. More...
 
void setMatrix (double rotation, const ossimDpt &scale, const ossimDpt &translation)
 
void setMatrixScale (const ossimDpt &scale)
 
void setMatrixRotation (double rotation)
 
void setMatrixTranslation (const ossimDpt &translation)
 
void snapTiePointTo (ossim_float64 multiple, ossimUnitType unitType)
 Utility method to snap the tie point to some multiple. More...
 
void snapTiePointToOrigin ()
 
void setElevationLookupFlag (bool flag)
 
bool getElevationLookupFlag () const
 
ossimUnitType getModelTransformUnitType () const
 
void setModelTransformUnitType (ossimUnitType unit)
 
bool hasModelTransform () const
 
virtual bool isAffectedByElevation () const
 Implementation of pure virtual ossimProjection::isAffectedByElevation method. More...
 
void setProjectionUnits (ossimUnitType units)
 
ossimUnitType getProjectionUnits () const
 OSSIM considers all map projection coordinates (including false eastings and northings) to be in meters. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimProjection
 ossimProjection ()
 
virtual ~ossimProjection ()
 
virtual void getRoundTripError (const ossimDpt &imagePoint, ossimDpt &errorResult) const
 
virtual void getRoundTripError (const ossimGpt &groundPoint, ossimDpt &errorResult) const
 
virtual void getGroundClipPoints (ossimGeoPolygon &gpts) const
 
virtual bool operator!= (const ossimProjection &projection) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 

Static Public Member Functions

static ossim_int32 computeZone (const ossimGpt &gpt)
 
static double computeZoneMeridian (ossim_int32 zone)
 Return in decimal degrees the zone meridian. More...
 

Private Member Functions

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 Mercator projection parameters as inputs, and sets the corresponding state variables. More...
 
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 projection parameters. More...
 
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) coordinates to Transverse Mercator projection (easting and northing) coordinates, according to the current ellipsoid and Transverse Mercator projection coordinates. More...
 
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 and northing) coordinates to geodetic (latitude and longitude) coordinates, according to the current ellipsoid and Transverse Mercator projection parameters. More...
 

Private Attributes

double theTranMerc_a
 
double theTranMerc_f
 
double theTranMerc_es
 
double theTranMerc_ebs
 
double theTranMerc_Origin_Lat
 
double theTranMerc_Origin_Long
 
double theTranMerc_False_Northing
 
double theTranMerc_False_Easting
 
double theTranMerc_Scale_Factor
 
double theTranMerc_ap
 
double theTranMerc_bp
 
double theTranMerc_cp
 
double theTranMerc_dp
 
double theTranMerc_ep
 
double theTranMerc_Delta_Easting
 
double theTranMerc_Delta_Northing
 
ossim_int32 theZone
 zone can be from 1 through 60 (0 == NOT SET) More...
 
char theHemisphere
 can be N or S. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ossimMapProjection
virtual ~ossimMapProjection ()
 
void updateFromTransform ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Attributes inherited from ossimMapProjection
ossimEllipsoid theEllipsoid
 This method verifies that the projection parameters match the current pcs code. More...
 
ossimGpt theOrigin
 
const ossimDatumtheDatum
 This is only set if we want to have built in datum shifting. More...
 
ossimDpt theMetersPerPixel
 Holds the number of meters per pixel. More...
 
ossimDpt theDegreesPerPixel
 Hold the decimal degrees per pixel. More...
 
ossimGpt theUlGpt
 Hold tie point in decimal degrees. More...
 
ossimDpt theUlEastingNorthing
 Hold tie point as easting northing. More...
 
ossimDpt theFalseEastingNorthing
 Hold the false easting northing. More...
 
ossim_uint32 thePcsCode
 Projection Coordinate System(PCS) code. More...
 
bool theElevationLookupFlag
 
ossimMatrix4x4 theModelTransform
 
ossimMatrix4x4 theInverseModelTransform
 
ossimUnitType theModelTransformUnitType
 
ossimUnitType theProjectionUnits
 Linear units of the projection as indicated in the projection's specification: More...
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 16 of file ossimUtmProjection.h.

Constructor & Destructor Documentation

◆ ossimUtmProjection() [1/4]

ossimUtmProjection::ossimUtmProjection ( const ossimEllipsoid ellipsoid = ossimEllipsoid(),
const ossimGpt origin = ossimGpt() 
)

Definition at line 61 of file ossimUtmProjection.cpp.

References ossimMapProjection::origin(), setHemisphere(), setZone(), and update().

Referenced by dup().

63  :
64  ossimMapProjection(ellipsoid, origin),
65  theTranMerc_a(6378137.0),
66  theTranMerc_f(1.0/298.257223563),
67  theTranMerc_es(0.0066943799901413800),
68  theTranMerc_ebs(0.0067394967565869),
72  theTranMerc_False_Easting(500000.0),
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),
80  theZone(1),
81  theHemisphere('N')
82 
83 {
84  setZone(origin);
86  update();
87 }
virtual ossimGpt origin() const
ossimMapProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
void setZone(const ossimGpt &ground)
char theHemisphere
can be N or S.
void setHemisphere(const ossimGpt &ground)

◆ ossimUtmProjection() [2/4]

ossimUtmProjection::ossimUtmProjection ( const ossimEllipsoid ellipsoid,
const ossimGpt origin,
ossim_int32  zone,
char  hemisphere 
)

Definition at line 89 of file ossimUtmProjection.cpp.

References setHemisphere(), setZone(), and update().

93  :
94  ossimMapProjection(ellipsoid, origin),
95  theTranMerc_a(6378137.0),
96  theTranMerc_f(1.0/298.257223563),
97  theTranMerc_es(0.0066943799901413800),
98  theTranMerc_ebs(0.0067394967565869),
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),
110  theZone(zone),
111  theHemisphere(hemisphere)
112 {
113  setZone(zone);
114  setHemisphere(hemisphere);
115  update();
116 }
virtual ossimGpt origin() const
ossimMapProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
void setZone(const ossimGpt &ground)
char theHemisphere
can be N or S.
void setHemisphere(const ossimGpt &ground)

◆ ossimUtmProjection() [3/4]

ossimUtmProjection::ossimUtmProjection ( ossim_int32  zone)

Definition at line 118 of file ossimUtmProjection.cpp.

References setZone(), and update().

119  :
121  theTranMerc_a(6378137.0),
122  theTranMerc_f(1.0/298.257223563),
123  theTranMerc_es(0.0066943799901413800),
124  theTranMerc_ebs(0.0067394967565869),
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),
136  theZone(zone),
137  theHemisphere('N')
138 {
139  setZone(zone);
140  update();
141 }
ossimMapProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
void setZone(const ossimGpt &ground)
char theHemisphere
can be N or S.

◆ ossimUtmProjection() [4/4]

ossimUtmProjection::ossimUtmProjection ( const ossimUtmProjection src)

Definition at line 143 of file ossimUtmProjection.cpp.

References setHemisphere(), setZone(), theHemisphere, theZone, and update().

144  :ossimMapProjection(src),
160  theZone(src.theZone),
162 {
163  setZone(theZone);
165  update();
166 }
ossimMapProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
void setZone(const ossimGpt &ground)
char theHemisphere
can be N or S.
void setHemisphere(const ossimGpt &ground)

Member Function Documentation

◆ computeZone()

ossim_int32 ossimUtmProjection::computeZone ( const ossimGpt gpt)
static

Definition at line 304 of file ossimUtmProjection.cpp.

References ossimGpt::latd(), ossimGpt::lond(), ossimGpt::lonr(), and M_PI.

Referenced by loadState(), setZone(), and ossimSonomaSensor::updateModel().

305 {
306  ossim_int32 result = 0;
307 
308  double longitude = ground.lonr();
309  double lat_Degrees = (ossim_int32)( (ground.latd()) + 0.00000005);
310  double long_Degrees = (ossim_int32)( (ground.lond()) + 0.00000005);
311 
312  if (longitude < M_PI)
313  result = (ossim_int32)( (31 + ((180 * longitude) / (6 * M_PI)) ) + 0.00000005);
314  else
315  result = (ossim_int32)( (((180 * longitude) / (6 * M_PI)) - 29) + 0.00000005);
316  if (result > 60)
317  result = 1;
318  /* UTM special cases */
319  if ((lat_Degrees > 55) && (lat_Degrees < 64) && (long_Degrees > -1)
320  && (long_Degrees < 3))
321  result = 31;
322  if ((lat_Degrees > 55) && (lat_Degrees < 64) && (long_Degrees > 2)
323  && (long_Degrees < 12))
324  result = 32;
325  if ((lat_Degrees > 71) && (long_Degrees > -1) && (long_Degrees < 9))
326  result = 31;
327  if ((lat_Degrees > 71) && (long_Degrees > 8) && (long_Degrees < 21))
328  result = 33;
329  if ((lat_Degrees > 71) && (long_Degrees > 20) && (long_Degrees < 33))
330  result = 35;
331  if ((lat_Degrees > 71) && (long_Degrees > 32) && (long_Degrees < 42))
332  result = 37;
333 
334  return result;
335 }
#define M_PI
int ossim_int32

◆ computeZoneMeridian()

double ossimUtmProjection::computeZoneMeridian ( ossim_int32  zone)
static

Return in decimal degrees the zone meridian.

Definition at line 337 of file ossimUtmProjection.cpp.

Referenced by loadState(), setZone(), and update().

338 {
339  return (6.0 * zone - 183.0);;
340 }

◆ Convert_Geodetic_To_Transverse_Mercator()

ossim_int32 ossimUtmProjection::Convert_Geodetic_To_Transverse_Mercator ( double  Latitude,
double  Longitude,
double *  Easting,
double *  Northing 
) const
private

The function Convert_Geodetic_To_Transverse_Mercator converts geodetic (latitude and longitude) coordinates to Transverse Mercator projection (easting and northing) coordinates, according to the current ellipsoid and Transverse Mercator projection coordinates.

If any errors occur, the error code(s) are returned by the function, otherwise TRANMERC_NO_ERROR is returned.

Latitude : Latitude in radians (input) Longitude : Longitude in radians (input) Easting : Easting/X in meters (output) Northing : Northing/Y in meters (output)

Definition at line 558 of file ossimUtmProjection.cpp.

References M_PI, SPHSN, SPHTMD, theTranMerc_ebs, theTranMerc_False_Easting, theTranMerc_False_Northing, theTranMerc_Origin_Lat, theTranMerc_Origin_Long, theTranMerc_Scale_Factor, TWO_PI, and UTM_NO_ERROR.

Referenced by forward(), and Set_Transverse_Mercator_Parameters().

563 { /* BEGIN Convert_Geodetic_To_Transverse_Mercator */
564 
565  /*
566  * The function Convert_Geodetic_To_Transverse_Mercator converts geodetic
567  * (latitude and longitude) coordinates to Transverse Mercator projection
568  * (easting and northing) coordinates, according to the current ellipsoid
569  * and Transverse Mercator projection coordinates. If any errors occur, the
570  * error code(s) are returned by the function, otherwise UTM_NO_ERROR is
571  * returned.
572  *
573  * Latitude : Latitude in radians (input)
574  * Longitude : Longitude in radians (input)
575  * Easting : Easting/X in meters (output)
576  * Northing : Northing/Y in meters (output)
577  */
578 
579  double c; /* Cosine of latitude */
580  double c2;
581  double c3;
582  double c5;
583  double c7;
584  double dlam; /* Delta longitude - Difference in Longitude */
585  double eta; /* constant - theTranMerc_ebs *c *c */
586  double eta2;
587  double eta3;
588  double eta4;
589  double s; /* Sine of latitude */
590  double sn; /* Radius of curvature in the prime vertical */
591  double t; /* Tangent of latitude */
592  double tan2;
593  double tan3;
594  double tan4;
595  double tan5;
596  double tan6;
597  double t1; /* Term in coordinate conversion formula - GP to Y */
598  double t2; /* Term in coordinate conversion formula - GP to Y */
599  double t3; /* Term in coordinate conversion formula - GP to Y */
600  double t4; /* Term in coordinate conversion formula - GP to Y */
601  double t5; /* Term in coordinate conversion formula - GP to Y */
602  double t6; /* Term in coordinate conversion formula - GP to Y */
603  double t7; /* Term in coordinate conversion formula - GP to Y */
604  double t8; /* Term in coordinate conversion formula - GP to Y */
605  double t9; /* Term in coordinate conversion formula - GP to Y */
606  double tmd; /* True Meridional distance */
607  double tmdo; /* True Meridional distance for latitude of origin */
608  ossim_int32 Error_Code = UTM_NO_ERROR;
609 // double temp_Origin;
610 // double temp_Long;
611 
612 // if ((Latitude < -MAX_LAT) || (Latitude > MAX_LAT))
613 // { /* Latitude out of range */
614 // Error_Code|= UTM_LAT_ERROR;
615 // }
616  if (Longitude > M_PI)
617  Longitude -= TWO_PI;
618 // if ((Longitude < (theTranMerc_Origin_Long - MAX_DELTA_LONG))
619 // || (Longitude > (theTranMerc_Origin_Long + MAX_DELTA_LONG)))
620 // {
621 // if (Longitude < 0)
622 // temp_Long = Longitude + TWO_PI;
623 // else
624 // temp_Long = Longitude;
625 // if (theTranMerc_Origin_Long < 0)
626 // temp_Origin = theTranMerc_Origin_Long + TWO_PI;
627 // else
628 // temp_Origin = theTranMerc_Origin_Long;
629 // if ((temp_Long < (temp_Origin - MAX_DELTA_LONG))
630 // || (temp_Long > (temp_Origin + MAX_DELTA_LONG)))
631 // Error_Code|= UTM_LON_ERROR;
632 // }
633  if (!Error_Code)
634  { /* no errors */
635 
636  /*
637  * Delta Longitude
638  */
639  dlam = Longitude - theTranMerc_Origin_Long;
640 
641 // if (fabs(dlam) > (9.0 * M_PI / 180))
642 // { /* Distortion will result if Longitude is more than 9 degrees from the Central Meridian */
643 // Error_Code |= UTM_LON_WARNING;
644 // }
645 
646  if (dlam > M_PI)
647  dlam -= TWO_PI;
648  if (dlam < -M_PI)
649  dlam += TWO_PI;
650  if (fabs(dlam) < 2.e-10)
651  dlam = 0.0;
652 
653  s = sin(Latitude);
654  c = cos(Latitude);
655  c2 = c * c;
656  c3 = c2 * c;
657  c5 = c3 * c2;
658  c7 = c5 * c2;
659  t = tan (Latitude);
660  tan2 = t * t;
661  tan3 = tan2 * t;
662  tan4 = tan3 * t;
663  tan5 = tan4 * t;
664  tan6 = tan5 * t;
665  eta = theTranMerc_ebs * c2;
666  eta2 = eta * eta;
667  eta3 = eta2 * eta;
668  eta4 = eta3 * eta;
669 
670  /* radius of curvature in prime vertical */
671  sn = SPHSN(Latitude);
672 
673  /* True Meridianal Distances */
674  tmd = SPHTMD(Latitude);
675 
676  /* Origin */
678 
679  /* northing */
680  t1 = (tmd - tmdo) * theTranMerc_Scale_Factor;
681  t2 = sn * s * c * theTranMerc_Scale_Factor/ 2.e0;
682  t3 = sn * s * c3 * theTranMerc_Scale_Factor * (5.e0 - tan2 + 9.e0 * eta
683  + 4.e0 * eta2) /24.e0;
684 
685  t4 = sn * s * c5 * theTranMerc_Scale_Factor * (61.e0 - 58.e0 * tan2
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;
689 
690  t5 = sn * s * c7 * theTranMerc_Scale_Factor * (1385.e0 - 3111.e0 *
691  tan2 + 543.e0 * tan4 - tan6) / 40320.e0;
692 
693  *Northing = theTranMerc_False_Northing + t1 + pow(dlam,2.e0) * t2
694  + pow(dlam,4.e0) * t3 + pow(dlam,6.e0) * t4
695  + pow(dlam,8.e0) * t5;
696 
697  /* Easting */
698  t6 = sn * c * theTranMerc_Scale_Factor;
699  t7 = sn * c3 * theTranMerc_Scale_Factor * (1.e0 - tan2 + eta ) /6.e0;
700  t8 = sn * c5 * theTranMerc_Scale_Factor * (5.e0 - 18.e0 * tan2 + tan4
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;
703  t9 = sn * c7 * theTranMerc_Scale_Factor * ( 61.e0 - 479.e0 * tan2
704  + 179.e0 * tan4 - tan6 ) /5040.e0;
705 
706  *Easting = theTranMerc_False_Easting + dlam * t6 + pow(dlam,3.e0) * t7
707  + pow(dlam,5.e0) * t8 + pow(dlam,7.e0) * t9;
708  }
709  return (Error_Code);
710 } /* END OF Convert_Geodetic_To_Transverse_Mercator */
#define SPHTMD(Latitude)
#define SPHSN(Latitude)
#define M_PI
#define UTM_NO_ERROR
#define TWO_PI
int ossim_int32

◆ Convert_Transverse_Mercator_To_Geodetic()

ossim_int32 ossimUtmProjection::Convert_Transverse_Mercator_To_Geodetic ( double  Easting,
double  Northing,
double *  Latitude,
double *  Longitude 
) const
private

The function Convert_Transverse_Mercator_To_Geodetic converts Transverse Mercator projection (easting and northing) coordinates to geodetic (latitude and longitude) coordinates, according to the current ellipsoid and Transverse Mercator projection parameters.

If any errors occur, the error code(s) are returned by the function, otherwise TRANMERC_NO_ERROR is returned.

Easting : Easting/X in meters (input) Northing : Northing/Y in meters (input) Latitude : Latitude in radians (output) Longitude : Longitude in radians (output)

Definition at line 713 of file ossimUtmProjection.cpp.

References M_PI, RAD_PER_DEG, SPHSN, SPHSR, SPHTMD, theTranMerc_ebs, theTranMerc_False_Easting, theTranMerc_False_Northing, theTranMerc_Origin_Lat, theTranMerc_Origin_Long, theTranMerc_Scale_Factor, TWO_PI, and UTM_NO_ERROR.

Referenced by inverse().

717 { /* BEGIN Convert_Transverse_Mercator_To_Geodetic */
718 
719  /*
720  * The function Convert_Transverse_Mercator_To_Geodetic converts Transverse
721  * Mercator projection (easting and northing) coordinates to geodetic
722  * (latitude and longitude) coordinates, according to the current ellipsoid
723  * and Transverse Mercator projection parameters. If any errors occur, the
724  * error code(s) are returned by the function, otherwise UTM_NO_ERROR is
725  * returned.
726  *
727  * Easting : Easting/X in meters (input)
728  * Northing : Northing/Y in meters (input)
729  * Latitude : Latitude in radians (output)
730  * Longitude : Longitude in radians (output)
731  */
732 
733  double c; /* Cosine of latitude */
734  double de; /* Delta easting - Difference in Easting (Easting-Fe) */
735  double dlam; /* Delta longitude - Difference in Longitude */
736  double eta; /* constant - theTranMerc_ebs *c *c */
737  double eta2;
738  double eta3;
739  double eta4;
740  double ftphi; /* Footpoint latitude */
741  int i; /* Loop iterator */
742  /*double s; Sine of latitude */
743  double sn; /* Radius of curvature in the prime vertical */
744  double sr; /* Radius of curvature in the meridian */
745  double t; /* Tangent of latitude */
746  double tan2;
747  double tan4;
748  double t10; /* Term in coordinate conversion formula - GP to Y */
749  double t11; /* Term in coordinate conversion formula - GP to Y */
750  double t12; /* Term in coordinate conversion formula - GP to Y */
751  double t13; /* Term in coordinate conversion formula - GP to Y */
752  double t14; /* Term in coordinate conversion formula - GP to Y */
753  double t15; /* Term in coordinate conversion formula - GP to Y */
754  double t16; /* Term in coordinate conversion formula - GP to Y */
755  double t17; /* Term in coordinate conversion formula - GP to Y */
756  double tmd; /* True Meridional distance */
757  double tmdo; /* True Meridional distance for latitude of origin */
758  ossim_int32 Error_Code = UTM_NO_ERROR;
759 
760 // if ((Easting < (theTranMerc_False_Easting - theTranMerc_Delta_Easting))
761 // ||(Easting > (theTranMerc_False_Easting + theTranMerc_Delta_Easting)))
762 // { /* Easting out of range */
763 // Error_Code |= UTM_EASTING_ERROR;
764 // }
765 // if ((Northing < (theTranMerc_False_Northing - theTranMerc_Delta_Northing))
766 // || (Northing > (theTranMerc_False_Northing + theTranMerc_Delta_Northing)))
767 // { /* Northing out of range */
768 // Error_Code |= UTM_NORTHING_ERROR;
769 // }
770 
771  if (!Error_Code)
772  {
773  /* True Meridional Distances for latitude of origin */
775 
776  /* Origin */
777  tmd = tmdo + (Northing - theTranMerc_False_Northing) / theTranMerc_Scale_Factor;
778 
779  /* First Estimate */
780  sr = SPHSR(0.e0);
781  ftphi = tmd/sr;
782 
783  for (i = 0; i < 5 ; i++)
784  {
785  t10 = SPHTMD (ftphi);
786  sr = SPHSR(ftphi);
787  ftphi = ftphi + (tmd - t10) / sr;
788  }
789 
790  /* Radius of Curvature in the meridian */
791  sr = SPHSR(ftphi);
792 
793  /* Radius of Curvature in the meridian */
794  sn = SPHSN(ftphi);
795 
796  /* Sine Cosine terms */
797  // s = sin(ftphi);
798  c = cos(ftphi);
799 
800  /* Tangent Value */
801  t = tan(ftphi);
802  tan2 = t * t;
803  tan4 = tan2 * tan2;
804  eta = theTranMerc_ebs * pow(c,2);
805  eta2 = eta * eta;
806  eta3 = eta2 * eta;
807  eta4 = eta3 * eta;
808  de = Easting - theTranMerc_False_Easting;
809  if (fabs(de) < 0.0001)
810  de = 0.0;
811 
812  /* Latitude */
813  t10 = t / (2.e0 * sr * sn * pow(theTranMerc_Scale_Factor, 2));
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)
816  * pow(theTranMerc_Scale_Factor,4));
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)
822  / ( 720.e0 * sr * pow(sn,5) * pow(theTranMerc_Scale_Factor, 6) );
823  t13 = t * ( 1385.e0 + 3633.e0 * tan2 + 4095.e0 * tan4 + 1575.e0
824  * pow(t,6))/ (40320.e0 * sr * pow(sn,7) * pow(theTranMerc_Scale_Factor,8));
825  *Latitude = ftphi - pow(de,2) * t10 + pow(de,4) * t11 - pow(de,6) * t12
826  + pow(de,8) * t13;
827 
828  t14 = 1.e0 / (sn * c * theTranMerc_Scale_Factor);
829 
830  t15 = (1.e0 + 2.e0 * tan2 + eta) / (6.e0 * pow(sn,3) * c *
831  pow(theTranMerc_Scale_Factor,3));
832 
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
837  * pow(theTranMerc_Scale_Factor,5));
838 
839  t17 = (61.e0 + 662.e0 * tan2 + 1320.e0 * tan4 + 720.e0
840  * pow(t,6)) / (5040.e0 * pow(sn,7) * c
841  * pow(theTranMerc_Scale_Factor,7));
842 
843  /* Difference in Longitude */
844  dlam = de * t14 - pow(de,3) * t15 + pow(de,5) * t16 - pow(de,7) * t17;
845 
846  /* Longitude */
847  (*Longitude) = theTranMerc_Origin_Long + dlam;
848  while (*Latitude > (90.0 * RAD_PER_DEG))
849  {
850  *Latitude = M_PI - *Latitude;
851  *Longitude += M_PI;
852  if (*Longitude > M_PI)
853  *Longitude -= TWO_PI;
854  }
855 
856  while (*Latitude < (-90.0 * RAD_PER_DEG))
857  {
858  *Latitude = - (*Latitude + M_PI);
859  *Longitude += M_PI;
860  if (*Longitude > M_PI)
861  *Longitude -= TWO_PI;
862  }
863  if (*Longitude > TWO_PI)
864  *Longitude -= TWO_PI;
865  if (*Longitude < -M_PI)
866  *Longitude += TWO_PI;
867 
868 // if (fabs(dlam) > (9.0 * M_PI / 180))
869 // { /* Distortion will result if Longitude is more than 9 degrees from the Central Meridian */
870 // Error_Code |= UTM_LON_WARNING;
871 // }
872  }
873  return (Error_Code);
874 } /* END OF Convert_Transverse_Mercator_To_Geodetic */
#define SPHTMD(Latitude)
#define SPHSN(Latitude)
#define M_PI
#define SPHSR(Latitude)
#define UTM_NO_ERROR
#define TWO_PI
#define RAD_PER_DEG
int ossim_int32

◆ dup()

ossimObject * ossimUtmProjection::dup ( ) const
virtual

Implements ossimProjection.

Definition at line 227 of file ossimUtmProjection.cpp.

References ossimUtmProjection().

228 {
229  ossimUtmProjection* proj = new ossimUtmProjection(*this);
230  return proj;
231 }
ossimUtmProjection(const ossimEllipsoid &ellipsoid=ossimEllipsoid(), const ossimGpt &origin=ossimGpt())

◆ forward()

ossimDpt ossimUtmProjection::forward ( const ossimGpt worldPoint) const
virtual

All map projections will convert the world coordinate to an easting northing (Meters).

Implements ossimMapProjection.

Definition at line 205 of file ossimUtmProjection.cpp.

References ossimGpt::changeDatum(), ossimDatum::code(), Convert_Geodetic_To_Transverse_Mercator(), ossimGpt::datum(), ossimGpt::latr(), ossimGpt::lonr(), and ossimMapProjection::theDatum.

Referenced by ossimApplanixUtmModel::updateModel(), and ossimSonomaSensor::updateModel().

206 {
207  double easting = 0.0;
208  double northing = 0.0;
209  ossimGpt gpt = latLon;
210 
211  if (theDatum)
212  {
213  if (theDatum->code() != latLon.datum()->code())
214  {
215  gpt.changeDatum(theDatum); // Shift to our datum.
216  }
217  }
218 
220  gpt.lonr(),
221  &easting,
222  &northing);
223 
224  return ossimDpt(easting, northing);
225 }
virtual const ossimString & code() const
Definition: ossimDatum.h:57
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
Definition: ossimGpt.cpp:316
double lonr() const
Returns the longitude in radian measure.
Definition: ossimGpt.h:76
double latr() const
latr().
Definition: ossimGpt.h:66
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 ossimDatum * theDatum
This is only set if we want to have built in datum shifting.

◆ Get_Transverse_Mercator_Parameters()

void ossimUtmProjection::Get_Transverse_Mercator_Parameters ( double *  a,
double *  f,
double *  Origin_Latitude,
double *  Central_Meridian,
double *  False_Easting,
double *  False_Northing,
double *  Scale_Factor 
) const
private

The function Get_Transverse_Mercator_Parameters returns the current ellipsoid and Transverse Mercator projection parameters.

a : Semi-major axis of ellipsoid, in meters (output) f : Flattening of ellipsoid (output) Origin_Latitude : Latitude in radians at the origin of the (output) projection Central_Meridian : Longitude in radians at the center of the (output) projection False_Easting : Easting/X at the center of the projection (output) False_Northing : Northing/Y at the center of the projection (output) Scale_Factor : Projection scale factor (output)

Definition at line 521 of file ossimUtmProjection.cpp.

References theTranMerc_a, theTranMerc_f, theTranMerc_False_Easting, theTranMerc_False_Northing, theTranMerc_Origin_Lat, theTranMerc_Origin_Long, and theTranMerc_Scale_Factor.

529 { /* BEGIN Get_Tranverse_Mercator_Parameters */
530  /*
531  * The function Get_Transverse_Mercator_Parameters returns the current
532  * ellipsoid and Transverse Mercator projection parameters.
533  *
534  * a : Semi-major axis of ellipsoid, in meters (output)
535  * f : Flattening of ellipsoid (output)
536  * Origin_Latitude : Latitude in radians at the origin of the (output)
537  * projection
538  * Central_Meridian : Longitude in radians at the center of the (output)
539  * projection
540  * False_Easting : Easting/X at the center of the projection (output)
541  * False_Northing : Northing/Y at the center of the projection (output)
542  * Scale_Factor : Projection scale factor (output)
543  */
544 
545  *a = theTranMerc_a;
546  *f = theTranMerc_f;
547  *Origin_Latitude = theTranMerc_Origin_Lat;
548  *Central_Meridian = theTranMerc_Origin_Long;
549  *False_Easting = theTranMerc_False_Easting;
550  *False_Northing = theTranMerc_False_Northing;
551  *Scale_Factor = theTranMerc_Scale_Factor;
552 
553  return;
554 } /* END OF Get_Tranverse_Mercator_Parameters */

◆ getFalseEasting()

double ossimUtmProjection::getFalseEasting ( ) const
virtual
Returns
The false easting.

Reimplemented from ossimMapProjection.

Definition at line 886 of file ossimUtmProjection.cpp.

References theTranMerc_False_Easting.

887 {
889 }

◆ getFalseNorthing()

double ossimUtmProjection::getFalseNorthing ( ) const
virtual
Returns
The false northing.

Reimplemented from ossimMapProjection.

Definition at line 891 of file ossimUtmProjection.cpp.

References theTranMerc_False_Northing.

892 {
894 }

◆ getHemisphere()

char ossimUtmProjection::getHemisphere ( ) const

◆ getPcsCode()

ossim_uint32 ossimUtmProjection::getPcsCode ( ) const
virtual

Returns the EPSG PCS code based on datum, zone, and hemisphere.

This overrides ossimMapProjection::getPcsCode(). Sets ossimMapProjection::thePcsCode on success.

Returns
code on success, 0 if datum is not set.

Reimplemented from ossimMapProjection.

Definition at line 927 of file ossimUtmProjection.cpp.

References ossimEpsgProjectionDatabase::getCodeFromUtmProj(), and ossimEpsgProjectionDatabase::instance().

928 {
929  // Always recompute in case origin, zone, or hemisphere were changed.
931 }
ossim_uint32 getCodeFromUtmProj(const ossimUtmProjection *proj) const
Given UTM projection, derives the associated EPSG code. This is faster than a Db lookup.
static ossimEpsgProjectionDatabase * instance()
Instantiates singleton instance of this class:

◆ getZone()

ossim_int32 ossimUtmProjection::getZone ( ) const

◆ inverse()

ossimGpt ossimUtmProjection::inverse ( const ossimDpt projectedPoint) const
virtual

Will take a point in meters and convert it to ground.

Implements ossimMapProjection.

Definition at line 192 of file ossimUtmProjection.cpp.

References Convert_Transverse_Mercator_To_Geodetic(), DEG_PER_RAD, ossimMapProjection::theDatum, ossimDpt::x, and ossimDpt::y.

Referenced by ossimSonomaSensor::lineSampleHeightToWorld(), ossimSonomaSensor::lineSampleToWorld(), and ossimApplanixUtmModel::updateModel().

193 {
194  double lat = 0.0;
195  double lon = 0.0;
196 
197  Convert_Transverse_Mercator_To_Geodetic(eastingNorthing.x,
198  eastingNorthing.y,
199  &lat,
200  &lon);
201 
202  return ossimGpt(lat*DEG_PER_RAD, lon*DEG_PER_RAD, 0.0, theDatum);
203 }
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...
#define DEG_PER_RAD
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.

◆ loadState()

bool ossimUtmProjection::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimMapProjection.

Definition at line 342 of file ossimUtmProjection.cpp.

References ossimString::c_str(), computeZone(), computeZoneMeridian(), ossimKeywordlist::find(), ossimKeywordNames::HEMISPHERE_KW, ossimGpt::latd(), ossimMapProjection::loadState(), ossimGpt::lond(), setHemisphere(), ossimMapProjection::theOrigin, theZone, ossimString::trim(), ossimString::upcase(), update(), and ossimKeywordNames::ZONE_KW.

344 {
345  const char* zone = kwl.find(prefix, ossimKeywordNames::ZONE_KW);
346  const char* hemisphere = kwl.find(prefix, ossimKeywordNames::HEMISPHERE_KW);
347 
348  ossimMapProjection::loadState(kwl, prefix);
349 
350  // initialize zone to a dummy value.
351  //
352  theZone = 0;
353 // if(ossimString(type) == STATIC_TYPE_NAME(ossimUtmProjection))
354  {
355  if(!zone)
356  {
358  }
359  else if (zone)
360  {
361  theZone = atoi(zone);
362 
363  if( (theZone < 1) || (theZone > 60) )
364  {
366  }
367  else
368  {
369 // if(!kwl.find(prefix, ossimKeywordNames::CENTRAL_MERIDIAN_KW))
370 // {
372 // }
373 // if(!kwl.find(prefix, ossimKeywordNames::ORIGIN_LATITUDE_KW))
374 // {
375  theOrigin.latd(0);
376 // }
377  }
378  }
379  if (hemisphere)
380  {
381  ossimString s = hemisphere;
382  s = s.trim();
383  s = s.upcase();
384 
385  setHemisphere(*s.c_str());
386  }
387  else
388  {
389  char hemisphere = theOrigin.latd()<0?'S':'N';
390  setHemisphere(hemisphere);
391  }
392  }
393 
394  update();
395 
396  return true;
397 }
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
const char * find(const char *key) const
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
static const char * ZONE_KW
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
static ossim_int32 computeZone(const ossimGpt &gpt)
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
static const char * HEMISPHERE_KW
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
static double computeZoneMeridian(ossim_int32 zone)
Return in decimal degrees the zone meridian.
void setHemisphere(const ossimGpt &ground)

◆ operator==()

bool ossimUtmProjection::operator== ( const ossimProjection projection) const
virtual

Returns TRUE if principal parameters are within epsilon tolerance.

Reimplemented from ossimMapProjection.

Definition at line 899 of file ossimUtmProjection.cpp.

References ossimMapProjection::operator==(), theHemisphere, and theZone.

900 {
901  bool result = false;
902  if ( this == &proj )
903  {
904  result = true; // Pointer addresses the same.
905  }
906  else
907  {
908  //---
909  // Check our stuff first. No sense going onto ossimMapProjection::operator==
910  // if we are not a utm projection.
911  //---
912  const ossimUtmProjection* p = dynamic_cast<const ossimUtmProjection*>(&proj);
913  if ( p )
914  {
915  if ( theZone == p->theZone )
916  {
917  if ( theHemisphere == p->theHemisphere )
918  {
919  result = ossimMapProjection::operator==(proj);
920  }
921  }
922  }
923  }
924  return result;
925 }
virtual bool operator==(const ossimProjection &projection) const
Compares this to arg projection and returns TRUE if the same.
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
char theHemisphere
can be N or S.

◆ print()

std::ostream & ossimUtmProjection::print ( std::ostream &  out) const
virtual

Prints data members to stream.

Returns stream&.

Reimplemented from ossimMapProjection.

Definition at line 876 of file ossimUtmProjection.cpp.

References ossimMapProjection::print(), theHemisphere, and theZone.

877 {
878  out << setiosflags(ios::fixed) << setprecision(15)
879  << "// ossimUtmProjection::print"
880  << "\ntheZone: " << theZone
881  << "\ntheHemisphere: " << theHemisphere
882  << endl;
883  return ossimMapProjection::print(out);
884 }
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
char theHemisphere
can be N or S.
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.

◆ saveState()

bool ossimUtmProjection::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimMapProjection.

Definition at line 399 of file ossimUtmProjection.cpp.

References ossimKeywordlist::add(), ossimKeywordNames::HEMISPHERE_KW, ossimMapProjection::saveState(), theHemisphere, theZone, and ossimKeywordNames::ZONE_KW.

400 {
401  kwl.add(prefix,
403  theZone,
404  true);
405 
406  kwl.add(prefix,
409  true);
410 
411  return ossimMapProjection::saveState(kwl, prefix);
412 }
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * ZONE_KW
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
static const char * HEMISPHERE_KW
char theHemisphere
can be N or S.

◆ Set_Transverse_Mercator_Parameters()

ossim_int32 ossimUtmProjection::Set_Transverse_Mercator_Parameters ( double  a,
double  f,
double  Origin_Latitude,
double  Central_Meridian,
double  False_Easting,
double  False_Northing,
double  Scale_Factor 
)
private

The function Set_Tranverse_Mercator_Parameters receives the ellipsoid parameters and Tranverse Mercator projection parameters as inputs, and sets the corresponding state variables.

If any errors occur, the error code(s) are returned by the function, otherwise TRANMERC_NO_ERROR is returned.

a : Semi-major axis of ellipsoid, in meters (input) f : Flattening of ellipsoid (input) Origin_Latitude : Latitude in radians at the origin of the (input) projection Central_Meridian : Longitude in radians at the center of the (input) projection False_Easting : Easting/X at the center of the projection (input) False_Northing : Northing/Y at the center of the projection (input) Scale_Factor : Projection scale factor (input)

Definition at line 414 of file ossimUtmProjection.cpp.

References Convert_Geodetic_To_Transverse_Mercator(), M_PI, MAX_DELTA_LONG, MAX_LAT, theTranMerc_a, theTranMerc_ap, theTranMerc_bp, theTranMerc_cp, theTranMerc_Delta_Easting, theTranMerc_Delta_Northing, theTranMerc_dp, theTranMerc_ebs, theTranMerc_ep, theTranMerc_es, theTranMerc_f, theTranMerc_False_Easting, theTranMerc_False_Northing, theTranMerc_Origin_Lat, theTranMerc_Origin_Long, TWO_PI, and UTM_NO_ERROR.

Referenced by update().

422 { /* BEGIN Set_Tranverse_Mercator_Parameters */
423  /*
424  * The function Set_Tranverse_Mercator_Parameters receives the ellipsoid
425  * parameters and Tranverse Mercator projection parameters as inputs, and
426  * sets the corresponding state variables. If any errors occur, the error
427  * code(s) are returned by the function, otherwise UTM_NO_ERROR is
428  * returned.
429  *
430  * a : Semi-major axis of ellipsoid, in meters (input)
431  * f : Flattening of ellipsoid (input)
432  * Origin_Latitude : Latitude in radians at the origin of the (input)
433  * projection
434  * Central_Meridian : Longitude in radians at the center of the (input)
435  * projection
436  * False_Easting : Easting/X at the center of the projection (input)
437  * False_Northing : Northing/Y at the center of the projection (input)
438  * Scale_Factor : Projection scale factor (input)
439  */
440 
441  double tn; /* True Meridianal distance constant */
442  double tn2;
443  double tn3;
444  double tn4;
445  double tn5;
446  double dummy_northing;
447  double TranMerc_b; /* Semi-minor axis of ellipsoid, in meters */
448 // double inv_f = 1 / f;
449  ossim_int32 Error_Code = UTM_NO_ERROR;
450 
451 // if (a <= 0.0)
452 // { /* Semi-major axis must be greater than zero */
453 // Error_Code |= UTM_A_ERROR;
454 // }
455 // if ((inv_f < 250) || (inv_f > 350))
456 // { /* Inverse flattening must be between 250 and 350 */
457 // Error_Code |= UTM_INV_F_ERROR;
458 // }
459 // if ((Origin_Latitude < -MAX_LAT) || (Origin_Latitude > MAX_LAT))
460 // { /* origin latitude out of range */
461 // Error_Code |= UTM_ORIGIN_LAT_ERROR;
462 // }
463 // if ((Central_Meridian < -M_PI) || (Central_Meridian > TWO_PI))
464 // { /* origin longitude out of range */
465 // Error_Code |= UTM_CENT_MER_ERROR;
466 // }
467 // if ((Scale_Factor < MIN_SCALE_FACTOR) || (Scale_Factor > MAX_SCALE_FACTOR))
468 // {
469 // Error_Code |= UTM_SCALE_FACTOR_ERROR;
470 // }
471  if (!Error_Code)
472  { /* no errors */
473  theTranMerc_a = a;
474  theTranMerc_f = f;
479  // theTranMerc_Scale_Factor = 1;
480 
481  /* Eccentricity Squared */
483  /* Second Eccentricity Squared */
484  theTranMerc_ebs = (1 / (1 - theTranMerc_es)) - 1;
485 
486  TranMerc_b = theTranMerc_a * (1 - theTranMerc_f);
487  /*True meridianal constants */
488  tn = (theTranMerc_a - TranMerc_b) / (theTranMerc_a + TranMerc_b);
489  tn2 = tn * tn;
490  tn3 = tn2 * tn;
491  tn4 = tn3 * tn;
492  tn5 = tn4 * tn;
493 
494  theTranMerc_ap = theTranMerc_a * (1.e0 - tn + 5.e0 * (tn2 - tn3)/4.e0
495  + 81.e0 * (tn4 - tn5)/64.e0 );
496  theTranMerc_bp = 3.e0 * theTranMerc_a * (tn - tn2 + 7.e0 * (tn3 - tn4)
497  /8.e0 + 55.e0 * tn5/64.e0 )/2.e0;
498  theTranMerc_cp = 15.e0 * theTranMerc_a * (tn2 - tn3 + 3.e0 * (tn4 - tn5 )/4.e0) /16.0;
499  theTranMerc_dp = 35.e0 * theTranMerc_a * (tn3 - tn4 + 11.e0 * tn5 / 16.e0) / 48.e0;
500  theTranMerc_ep = 315.e0 * theTranMerc_a * (tn4 - tn5) / 512.e0;
508  &dummy_northing);
509  theTranMerc_Origin_Lat = Origin_Latitude;
510  if (Central_Meridian > M_PI)
511  Central_Meridian -= TWO_PI;
512  theTranMerc_Origin_Long = Central_Meridian;
513  theTranMerc_False_Northing = False_Northing;
514  theTranMerc_False_Easting = False_Easting;
515  // theTranMerc_Scale_Factor = Scale_Factor;
516  } /* END OF if(!Error_Code) */
517  return (Error_Code);
518 } /* END of Set_Transverse_Mercator_Parameters */
#define M_PI
#define MAX_DELTA_LONG
#define UTM_NO_ERROR
#define TWO_PI
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...
#define MAX_LAT
int ossim_int32

◆ setHemisphere() [1/2]

void ossimUtmProjection::setHemisphere ( const ossimGpt ground)

◆ setHemisphere() [2/2]

void ossimUtmProjection::setHemisphere ( char  hemisphere)

Definition at line 281 of file ossimUtmProjection.cpp.

References ossimGpt::latd(), theHemisphere, ossimMapProjection::theOrigin, and theTranMerc_False_Northing.

282 {
283  hemisphere = toupper(hemisphere);
284  if((hemisphere != 'N') &&
285  (hemisphere != 'S'))
286  {
287  theHemisphere = theOrigin.latd() < 0?'S':'N';
288  }
289  else
290  {
291  theHemisphere = hemisphere;
292  }
293 
294  if (theHemisphere == 'N')
295  {
297  }
298  else
299  {
300  theTranMerc_False_Northing = 10000000.0;
301  }
302 }
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
char theHemisphere
can be N or S.

◆ setOrigin()

void ossimUtmProjection::setOrigin ( const ossimGpt origin)
virtual

This will set the utm zone and utm origin base on origin passed in.

Note
If the origin latitude is not 0.0 it will also set the hemisphere. If 0.0 hemisphere is unchanged from previous stored value.

Reimplemented from ossimMapProjection.

Definition at line 243 of file ossimUtmProjection.cpp.

References ossimGpt::latd(), ossimMapProjection::origin(), setHemisphere(), ossimMapProjection::setOrigin(), and setZone().

Referenced by ATP::AtpGenerator::constructChain(), and ossimEpsgProjectionFactory::createProjFromAutoCode().

244 {
245  setZone(origin);
246  // NOTE: We will not set the hemisphere if the origin latitude is 0.0.
247  if (origin.latd() != 0.0)
248  {
250  }
252 }
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
virtual ossimGpt origin() const
void setZone(const ossimGpt &ground)
void setHemisphere(const ossimGpt &ground)

◆ setZone() [1/2]

void ossimUtmProjection::setZone ( const ossimGpt ground)

◆ setZone() [2/2]

void ossimUtmProjection::setZone ( ossim_int32  zone)

Definition at line 259 of file ossimUtmProjection.cpp.

References computeZone(), computeZoneMeridian(), ossimGpt::datum(), ossimGpt::latd(), ossimGpt::lond(), ossimGpt::lonr(), ossimMapProjection::theDatum, ossimMapProjection::theOrigin, theTranMerc_Origin_Long, and theZone.

260 {
261  if( (zone < 1) || (zone > 60) )
262  {
264  }
265  else
266  {
267  theZone = zone;
268  }
270  theOrigin.latd(0);
273 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
double lonr() const
Returns the longitude in radian measure.
Definition: ossimGpt.h:76
static ossim_int32 computeZone(const ossimGpt &gpt)
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
static double computeZoneMeridian(ossim_int32 zone)
Return in decimal degrees the zone meridian.
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.

◆ update()

void ossimUtmProjection::update ( )
virtual

Reimplemented from ossimMapProjection.

Definition at line 168 of file ossimUtmProjection.cpp.

References computeZoneMeridian(), ossimEllipsoid::getA(), ossimEllipsoid::getFlattening(), ossimGpt::latd(), ossimGpt::latr(), ossimGpt::lond(), ossimGpt::lonr(), ossimMapProjection::origin(), Set_Transverse_Mercator_Parameters(), ossimMapProjection::theEllipsoid, ossimMapProjection::theFalseEastingNorthing, theHemisphere, ossimMapProjection::theOrigin, theTranMerc_False_Easting, theTranMerc_False_Northing, theTranMerc_Scale_Factor, theZone, ossimMapProjection::update(), ossimDpt::x, and ossimDpt::y.

Referenced by ossimEpsgProjectionFactory::createProjFromAutoCode(), loadState(), and ossimUtmProjection().

169 {
172  origin.latd(0.0);
173  double falseNorthing = 10000000.0;
174  if (theHemisphere == 'N')
175  {
176  falseNorthing = 0.0;
177  }
180  origin.latr(),
181  origin.lonr(),
183  falseNorthing,
185 
188 
190 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
double y
Definition: ossimDpt.h:165
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
const double & getA() const
virtual ossimGpt origin() const
double lonr() const
Returns the longitude in radian measure.
Definition: ossimGpt.h:76
ossim_int32 theZone
zone can be from 1 through 60 (0 == NOT SET)
double x
Definition: ossimDpt.h:164
double latr() const
latr().
Definition: ossimGpt.h:66
const double & getFlattening() const
char theHemisphere
can be N or S.
ossimEllipsoid theEllipsoid
This method verifies that the projection parameters match the current pcs code.
ossimDpt theFalseEastingNorthing
Hold the false easting northing.
static double computeZoneMeridian(ossim_int32 zone)
Return in decimal degrees the zone meridian.
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...

Member Data Documentation

◆ theHemisphere

char ossimUtmProjection::theHemisphere
private

can be N or S.

Definition at line 223 of file ossimUtmProjection.h.

Referenced by getHemisphere(), operator==(), ossimUtmProjection(), print(), saveState(), setHemisphere(), and update().

◆ theTranMerc_a

double ossimUtmProjection::theTranMerc_a
private

◆ theTranMerc_ap

double ossimUtmProjection::theTranMerc_ap
private

Definition at line 205 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_bp

double ossimUtmProjection::theTranMerc_bp
private

Definition at line 206 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_cp

double ossimUtmProjection::theTranMerc_cp
private

Definition at line 207 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_Delta_Easting

double ossimUtmProjection::theTranMerc_Delta_Easting
private

Definition at line 212 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_Delta_Northing

double ossimUtmProjection::theTranMerc_Delta_Northing
private

Definition at line 213 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_dp

double ossimUtmProjection::theTranMerc_dp
private

Definition at line 208 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_ebs

double ossimUtmProjection::theTranMerc_ebs
private

◆ theTranMerc_ep

double ossimUtmProjection::theTranMerc_ep
private

Definition at line 209 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_es

double ossimUtmProjection::theTranMerc_es
private

Definition at line 192 of file ossimUtmProjection.h.

Referenced by Set_Transverse_Mercator_Parameters().

◆ theTranMerc_f

double ossimUtmProjection::theTranMerc_f
private

◆ theTranMerc_False_Easting

double ossimUtmProjection::theTranMerc_False_Easting
private

◆ theTranMerc_False_Northing

double ossimUtmProjection::theTranMerc_False_Northing
private

◆ theTranMerc_Origin_Lat

double ossimUtmProjection::theTranMerc_Origin_Lat
private

◆ theTranMerc_Origin_Long

double ossimUtmProjection::theTranMerc_Origin_Long
private

◆ theTranMerc_Scale_Factor

double ossimUtmProjection::theTranMerc_Scale_Factor
private

◆ theZone

ossim_int32 ossimUtmProjection::theZone
private

zone can be from 1 through 60 (0 == NOT SET)

Definition at line 218 of file ossimUtmProjection.h.

Referenced by getZone(), loadState(), operator==(), ossimUtmProjection(), print(), saveState(), setZone(), and update().


The documentation for this class was generated from the following files: