List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
utl::UTMPoint Class Reference

Class to hold and convert a point in geodetic coordinates. More...

#include <utl/UTMPoint.h>

Classes

class  UTMException
 Report problems in UTM handling. More...
 
class  UTMZoneException
 Report attempts to use invalid UTM zone. More...
 

Public Types

enum  ZoneRange { eZoneMin = 1, eZoneMax = 60 }
 range of zone numbers More...
 

Public Member Functions

char GetBand () const
 Get the band. More...
 
boost::tuple< double, double,
double, int, char > 
GetCoordinates () const
 Get norting, easting, height, zone, and band. More...
 
boost::tuple< double, double,
double > 
GetCoordinates3 () const
 Get norting, easting, and height. More...
 
boost::tuple< double, double,
double, int > 
GetCoordinates4 () const
 Get norting, easting, height, and zone. More...
 
double GetEasting () const
 Get the easting. More...
 
const ReferenceEllipsoidGetEllipsoid () const
 Get the reference ellipsoid. More...
 
boost::tuple< double, double,
double > 
GetGeodeticCoordinates () const
 Get geodetic latitude, longitude, height. More...
 
double GetHeight () const
 Get the height. More...
 
double GetNorthing () const
 Get the northing. More...
 
Point GetPoint (const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
 Get a cartesian point from an UTMPoint. More...
 
int GetZone () const
 Get the zone. More...
 
bool operator!= (const UTMPoint &rhs) const
 inequality operator More...
 
bool operator== (const UTMPoint &rhs) const
 equality operator More...
 
 UTMPoint (const double theNorthing, const double theEasting, const double theHeight, const int theZone, const char theBand, const ReferenceEllipsoid &theEllipsoid)
 Construct UTMPoint from the UTM information. More...
 
 UTMPoint (const double theNorthing, const double theEasting, const double theHeight, const int theZone, const char theBand, const ReferenceEllipsoid::EllipsoidID theEllipsoidID)
 Construct UTMPoint from the UTM information, ellipsoid by name. More...
 
 UTMPoint (const UTMPoint &theUTMPoint, const ReferenceEllipsoid &theEllipsoid)
 Construct UTMPoint with an alternative reference ellipsoid. More...
 
 UTMPoint (const UTMPoint &theUTMPoint, const ReferenceEllipsoid::EllipsoidID theEllipsoidID)
 Construct UTMPoint with an alternative reference ellipsoid. More...
 
 UTMPoint (const Point &thePoint, const ReferenceEllipsoid &theEllipsoid)
 Construct UTMPoint from cartesian point with given reference ellipsoid. More...
 
 UTMPoint (const Point &thePoint, const ReferenceEllipsoid::EllipsoidID theEllipsoidID)
 Construct UTMPoint from cartesian point with named reference ellipsoid. More...
 
 UTMPoint (const double theLatitude, const double theLongitude, const double theHeight, const ReferenceEllipsoid &theEllipsoid)
 Construct UTMPoint from geodetic Coordinates with given ellipsoid. More...
 
 UTMPoint (const double theLatitude, const double theLongitude, const double theHeight, const ReferenceEllipsoid::EllipsoidID theEllipsoidID)
 Construct UTMPoint from geodetic Coordinates with named ellipsoid. More...
 
 ~UTMPoint ()
 Destructor - should be virtual for base classes. More...
 

Private Member Functions

void SetFromCartesian (const Point &thePoint)
 Construction from Cartesian coordinates. More...
 
void SetFromLatitudeLongitude (const double theLatitude, const double theLongitude)
 Construction from geodetic Latitude and Longitude (height identical) More...
 
void SetFromOtherDatum (const UTMPoint &theUTMPoint)
 Datum transformation. More...
 
void VerifyZone ()
 verify zone and throw exception if out of bounds More...
 

Static Private Member Functions

static char BandFromLatitude (const double theLatitude)
 Calculate band letter from latitude and longitude. More...
 
static int ZoneFromLatitudeLongitude (const double theLatitude, const double theLongitude)
 Calculate zone number from latitude and longitude. More...
 

Private Attributes

char fBand
 Letter indicating band, C-X, w/o O, I. More...
 
double fEasting
 
const ReferenceEllipsoidfEllipsoid
 
double fHeight
 
double fNorthing
 
int fZone
 zone runs from 1 to 60 More...
 

Detailed Description

Class to hold and convert a point in geodetic coordinates.

This class implements a point represented with UTM coordinates. It provides conversion to and from Points and geodetic latitude/longitude.

Note
Due to rounding errors, the latitude/longitude to UTM conversion can sometimes place a point into a neighbouring zone or band. This is a consequence of the internal representation of all angles in radian, which implies that the representation of an angle like 90*deg is not precise.
The implementation can only handle reference ellipsoids that are co-centric with the earth. This includes WGS84, but excludes some local grids.
Author
Lukas Nellen
Date
3 August 2003

Definition at line 40 of file UTMPoint.h.

Member Enumeration Documentation

range of zone numbers

Enumerator
eZoneMin 

Minimum UTM zone number.

eZoneMax 

Maximum UTM zone number.

Definition at line 43 of file UTMPoint.h.

Constructor & Destructor Documentation

utl::UTMPoint::UTMPoint ( const double  theNorthing,
const double  theEasting,
const double  theHeight,
const int  theZone,
const char  theBand,
const ReferenceEllipsoid theEllipsoid 
)
inline

Construct UTMPoint from the UTM information.

Construct an UTM point from the following information:

  • Northing
  • Easting in the given zone
  • Height (above reference ellipsoid)
  • The zone (strip) number (1 to 60)
  • The reference ellipsoid

Definition at line 62 of file UTMPoint.h.

References VerifyZone().

utl::UTMPoint::UTMPoint ( const double  theNorthing,
const double  theEasting,
const double  theHeight,
const int  theZone,
const char  theBand,
const ReferenceEllipsoid::EllipsoidID  theEllipsoidID 
)
inline

Construct UTMPoint from the UTM information, ellipsoid by name.

Construct an UTM point from the following information:

  • Northing
  • Easting in the given zone
  • Height (above reference ellipsoid)
  • The zone (strip) number (1 to 60)
  • The name of a known reference ellipsoid

Definition at line 90 of file UTMPoint.h.

References VerifyZone().

utl::UTMPoint::UTMPoint ( const UTMPoint theUTMPoint,
const ReferenceEllipsoid theEllipsoid 
)
inline

Construct UTMPoint with an alternative reference ellipsoid.

This constructor is for datum transformations. It constructs an UTMPoint with Northing, Easting, and Height in the grid defined by the new reference ellipsoid.

Definition at line 110 of file UTMPoint.h.

References SetFromOtherDatum().

utl::UTMPoint::UTMPoint ( const UTMPoint theUTMPoint,
const ReferenceEllipsoid::EllipsoidID  theEllipsoidID 
)
inline

Construct UTMPoint with an alternative reference ellipsoid.

This constructor is for datum transformations. It constructs an UTMPoint with Northing, Easting, and Height in the grid defined by the new reference ellipsoid.

Definition at line 120 of file UTMPoint.h.

References SetFromOtherDatum().

utl::UTMPoint::UTMPoint ( const Point thePoint,
const ReferenceEllipsoid theEllipsoid 
)
inline

Construct UTMPoint from cartesian point with given reference ellipsoid.

This constructor implements the conversion from a point in cartesian coordinates to UTM coordinates with a given reference ellipsoid.

Definition at line 133 of file UTMPoint.h.

References SetFromCartesian().

utl::UTMPoint::UTMPoint ( const Point thePoint,
const ReferenceEllipsoid::EllipsoidID  theEllipsoidID 
)
inline

Construct UTMPoint from cartesian point with named reference ellipsoid.

This constructor implements the conversion from a point in cartesian coordinates to UTM coordinates with a given reference ellipsoid.

Definition at line 142 of file UTMPoint.h.

References SetFromCartesian().

utl::UTMPoint::UTMPoint ( const double  theLatitude,
const double  theLongitude,
const double  theHeight,
const ReferenceEllipsoid theEllipsoid 
)
inline

Construct UTMPoint from geodetic Coordinates with given ellipsoid.

This constructor implements the conversion from geodetic latitude, lngitude, and height. The height is the same in both representations.

The constructor takes a given reference ellipsoid.

Definition at line 157 of file UTMPoint.h.

References SetFromLatitudeLongitude().

utl::UTMPoint::UTMPoint ( const double  theLatitude,
const double  theLongitude,
const double  theHeight,
const ReferenceEllipsoid::EllipsoidID  theEllipsoidID 
)
inline

Construct UTMPoint from geodetic Coordinates with named ellipsoid.

This constructor implements the conversion from geodetic latitude, lngitude, and height. The height is the same in both representations.

The constructor takes a named reference ellipsoid.

Definition at line 175 of file UTMPoint.h.

References SetFromLatitudeLongitude().

utl::UTMPoint::~UTMPoint ( )
inline

Destructor - should be virtual for base classes.

Definition at line 186 of file UTMPoint.h.

Member Function Documentation

char UTMPoint::BandFromLatitude ( const double  theLatitude)
staticprivate

Calculate band letter from latitude and longitude.

Definition at line 302 of file UTMPoint.cc.

References utl::deg, and ERROR.

Referenced by SetFromLatitudeLongitude().

char utl::UTMPoint::GetBand ( ) const
inline
boost::tuple<double, double, double, int, char> utl::UTMPoint::GetCoordinates ( ) const
inline

Get norting, easting, height, zone, and band.

Definition at line 232 of file UTMPoint.h.

References fBand, fEasting, fHeight, fNorthing, and fZone.

Referenced by utl::operator<<(), GeometryExampleNS::GeometryExample::Run(), testUTMPoint::testAssignement(), and testUTMPoint::testConstructors().

boost::tuple<double, double, double> utl::UTMPoint::GetCoordinates3 ( ) const
inline
boost::tuple<double, double, double, int> utl::UTMPoint::GetCoordinates4 ( ) const
inline

Get norting, easting, height, and zone.

Definition at line 228 of file UTMPoint.h.

References fEasting, fHeight, fNorthing, and fZone.

Referenced by testUTMPoint::testAssignement(), and testUTMPoint::testConstructors().

double utl::UTMPoint::GetEasting ( ) const
inline
const ReferenceEllipsoid& utl::UTMPoint::GetEllipsoid ( ) const
inline
boost::tuple< double, double, double > UTMPoint::GetGeodeticCoordinates ( ) const
double utl::UTMPoint::GetHeight ( ) const
inline

Get the height.

Definition at line 212 of file UTMPoint.h.

References fHeight.

Referenced by sdet::SDenseStationListXMLManager::DenseStations::AddStation(), RdStationAssociator::RdStationAssociator::AddVirtualStations(), RdAirplane::Ads_bEvent::Ads_bEvent(), FdProfileReconstructorKG::CherenkovFluorescenceMatrix::CalculateFluorescenceMatrix(), RdREASSimPreparator::RdREASSimPreparator::CorsikaInpFileWriter(), RdREASSimPreparatorNG::RdREASSimPreparatorNG::CreateCoREASContent(), RdREASSimPreparatorNG::RdREASSimPreparatorNG::CreateCoREASListContent(), RdZHAireSSimPreparator::RdZHAireSSimPreparator::CreateFiles(), RdEVASimPreparator::RdEVASimPreparator::EVAFileWriter(), otoa::FD2ADST::FillFdCoreAxis(), otoa::RdFiller::FillRadioShower(), otoa::SD2ADST::FillSEvent(), otoa::Offline2ADST::FillSim(), otoa::SD2ADST::FillUniversality(), StereoGeometryFinderOG::StereoGeometryFinder::FindAxisStereo(), RdZHAireSSimPreparator::RdZHAireSSimPreparator::GenerateCoreAroundStation(), RdREASSimPreparatorNG::RdREASSimPreparatorNG::GenerateCoreAroundStation(), EventGeneratorOG::EventGenerator::GenerateSphereCentricCore(), HybridGeometryFinderWG::HybridGeometryFinder::GetDataFromPreviousFit(), fdet::FTimeFitModel::GetTimeAtAperture(), FdProfileReconstructorKG::CherenkovFluorescenceMatrix::GillerFraction(), FdProfileReconstructorKG::CherenkovFluorescenceMatrix::GoraFraction(), atm::InclinedAtmosphericProfile::InclinedAtmosphericProfile(), EventGeneratorOG::EventGenerator::Init(), RdTimeCalibration::RdTimeCalibration::Init(), atm::SimShowerProfileModel::LazyInit(), io::CorsikaShowerFileGeometryProducer::MakeGroundParticleCoordinateSystem(), StereoGeometryFinderOG::StereoGeometryFinder::MinuitFitFuncStereoHybrid(), FdProfileReconstructorKG::CherenkovFluorescenceMatrix::PekalaFraction(), io::ZHAireSFile::Read(), io::SELFASFile::Read(), RdREASSimPreparator::RdREASSimPreparator::REASFileWriter(), OverrideConfigNS::OverrideConfig::Run(), AtmosphericProfileNS::AtmosphericProfile::Run(), UniversalityFitter::UniversalityFitter::Run(), io::CorsikaShowerFile::SetHeaderTrailer(), testUTMPoint::testAssignement(), testUTMPoint::testConstructors(), CoordinateSystemRegistryTest::testPampaAmarilla(), RSQLManagerTest::testStationListManager(), and RdREASSimPreparator::RdREASSimPreparator::WriteDetectorFile().

double utl::UTMPoint::GetNorthing ( ) const
inline
Point UTMPoint::GetPoint ( const CoordinateSystemPtr theCS = CoordinateSystemPtr()) const

Get a cartesian point from an UTMPoint.

This member function implements the conversion from UTM coordinates to cartesian coordinates. One can specify the desired coordinate system for representing the point internally.

Definition at line 45 of file UTMPoint.cc.

References fEllipsoid, GetGeodeticCoordinates(), and utl::ReferenceEllipsoid::LatitudeLongitudeHeightToPoint().

Referenced by RdAirplane::Interpolator3D::_getCoordinates(), evt::ConvertEventToEc(), utl::AugerCoordinateSystemConstructor< Policy >::Create(), fwk::LocalCoordinateSystemConstructor< Policy >::Create(), FdAxisFinderOG::FdAxisFinder::FindAxisLaser(), StereoGeometryFinderOG::StereoGeometryFinder::FindAxisStereo(), StereoGeometryFinderOG::StereoGeometryFinder::FindAxisStereoHybrid(), HybridGeometryFinderWG::HybridGeometryFinder::FitAxis(), EventGeneratorOG::EventGenerator::GenerateArrayCentricRandomizedCoreAroundRandomStation(), EventGeneratorOG::EventGenerator::GenerateCoreAroundStation(), EventGeneratorOG::EventGenerator::GenerateSphereCentricCore(), cdet::Station::GetPosition(), rdet::Station::GetPosition(), sdet::Station::GetPosition(), RdStationPositionCorrectionOG::RdStationPositionCorrection::Init(), SdStationPositionCorrectionOG::SdStationPositionCorrection::Init(), RdAirplane::RdAirplaneTiming::Init(), HybridGeometryFinderWG::HybridGeometryFinder::MinuitFitFuncAxis(), FdAxisFinderOG::FdAxisFinder::MinuitFitFuncLaser(), StereoGeometryFinderOG::StereoGeometryFinder::MinuitFitFuncStereo(), StereoGeometryFinderOG::StereoGeometryFinder::MinuitFitFuncStereoHybrid(), testUTMPoint::oneUTMConversion(), HybridGeometryFinderWG::AxisParameterCalculator::operator()(), HybridGeometryFinderWG::HybridGeometryFinder::RecalculateChiSquare(), GeometryExampleNS::GeometryExample::Run(), EventGeneratorOG::EventGenerator::Run(), ShowerInventorNS::ShowerInventor::Run(), LocalCoordinateSystemTest::testCreate(), testAugerCoordinateSystem::testCS(), CoordinateSystemRegistryTest::testPampaAmarilla(), testAugerCoordinateSystem::testSiteCS(), and testUTMPoint::testUTMConversions().

int utl::UTMPoint::GetZone ( ) const
inline
bool utl::UTMPoint::operator!= ( const UTMPoint rhs) const
inline

inequality operator

Definition at line 202 of file UTMPoint.h.

References operator==().

bool utl::UTMPoint::operator== ( const UTMPoint rhs) const
inline

equality operator

Definition at line 190 of file UTMPoint.h.

References fBand, fEasting, fEllipsoid, fHeight, fNorthing, and fZone.

Referenced by operator!=().

void UTMPoint::SetFromCartesian ( const Point thePoint)
private

Construction from Cartesian coordinates.

Definition at line 160 of file UTMPoint.cc.

References fEllipsoid, fHeight, utl::ReferenceEllipsoid::PointToLatitudeLongitudeHeight(), and SetFromLatitudeLongitude().

Referenced by UTMPoint().

void UTMPoint::SetFromLatitudeLongitude ( const double  theLatitude,
const double  theLongitude 
)
private

Construction from geodetic Latitude and Longitude (height identical)

Latitude Longitude to UTM converstion. The formulae are taken from the code by B. Revenu. See GAP 2001-038

Definition at line 179 of file UTMPoint.cc.

References RdGeoCeLDFFitter::a, BandFromLatitude(), fBand, fEasting, fEllipsoid, fNorthing, fZone, utl::ReferenceEllipsoid::GetEccentricity2(), utl::ReferenceEllipsoid::GetEquatorialRadius(), utl::rad, sqrt(), and ZoneFromLatitudeLongitude().

Referenced by SetFromCartesian(), and UTMPoint().

void UTMPoint::SetFromOtherDatum ( const UTMPoint theUTMPoint)
private

Datum transformation.

Definition at line 142 of file UTMPoint.cc.

References FATAL, fBand, fEasting, fEllipsoid, fHeight, fNorthing, and fZone.

Referenced by UTMPoint().

void UTMPoint::VerifyZone ( )
private

verify zone and throw exception if out of bounds

Definition at line 257 of file UTMPoint.cc.

References eZoneMax, eZoneMin, FATAL, and fZone.

Referenced by UTMPoint().

int UTMPoint::ZoneFromLatitudeLongitude ( const double  theLatitude,
const double  theLongitude 
)
staticprivate

Calculate zone number from latitude and longitude.

Definition at line 274 of file UTMPoint.cc.

References utl::deg, and eZoneMax.

Referenced by SetFromLatitudeLongitude().

Member Data Documentation

char utl::UTMPoint::fBand
private

Letter indicating band, C-X, w/o O, I.

Definition at line 283 of file UTMPoint.h.

Referenced by GetBand(), GetCoordinates(), GetGeodeticCoordinates(), operator==(), SetFromLatitudeLongitude(), and SetFromOtherDatum().

double utl::UTMPoint::fEasting
private
const ReferenceEllipsoid* utl::UTMPoint::fEllipsoid
private
double utl::UTMPoint::fHeight
private
double utl::UTMPoint::fNorthing
private
int utl::UTMPoint::fZone
private

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

, generated on Tue Sep 26 2023.