GeographicLib::TransverseMercator Class Reference

Transverse Mercator Projection. More...

#include <GeographicLib/TransverseMercator.hpp>

List of all members.

Public Member Functions

 TransverseMercator (real a, real r, real k0)
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
Math::real MajorRadius () const throw ()
Math::real InverseFlattening () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const TransverseMercator UTM

Detailed Description

Transverse Mercator Projection.

This uses Krüger's method which evaluates the projection and its inverse in terms of a series. See

Krüger's method has been extended from 4th to 6th order. The maximum errors is 5 nm (ground distance) for all positions within 35 degrees of the central meridian. The error in the convergence is 2e-15" and the relative error in the scale is 6e-12%%. (See Accuracy of transverse Mercator projection for the weasel words.) The speed penalty in going to 6th order is only about 1%. GeographicLib::TransverseMercatorExact is an alternative implementation of the projection using exact formulas which yield accurate (to 8 nm) results over the entire ellipsoid.

The ellipsoid parameters and the central scale are set in the constructor. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the TransverseMercator::Forward and TransverseMercator::Reverse functions. The latitude of origin is taken to be the equator. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling funtcion. For example, the UTMUPS class applies the false easting and false northing for the UTM projections. A more complicated example is the British National Grid (EPSG:7405) which requires the use of a latitude of origin. This is accommodated by (constants from A guide to coordinate systems in Great Britain):

   const double
     a = 6377563.396, b = 6356256.910, r = a/(a - b), // Airy 1830 ellipsoid
     k0 = 0.9996012717, lat0 = 49, lon0 = -2, // central scale and origin
     fe = 400000, fn = -100000;               // false easting and northing
   // Set up basic projection
   const GeographicLib::TransverseMercator OSGB(a, r, k0);
   double x0, y0;
   {
     double gamma, k;
     // Transform origin point
     OSGB.Forward(lon0, lat0, lon0, x0, y0, gamma, k);
     x0 -= fe; y0 -= fn;         // Combine result with false origin
   }
   double lat, lon, x, y, gamma, k;
   // Sample conversion from geodetic to OSGB grid
   std::cin >> lat >> lon;
   OSGB.Forward(lon0, lat, lon, x, y, gamma, k);
   x -= x0; y -= y0;
   std::cout << x << " " << y << "\n";
   // Sample conversion from OSGB grid to geodetic
   std::cin >> x >> y;
   x += x0; y += y0;
   OSGB.Reverse(lon0, x, y, lat, lon, gamma, k);
   std::cout << lat << " " << lon << "\n";
   

See TransverseMercator.cpp for more information on the implementation.

See Transverse Mercator Projection for a discussion of this projection.

Definition at line 93 of file TransverseMercator.hpp.


Constructor & Destructor Documentation

GeographicLib::TransverseMercator::TransverseMercator ( real  a,
real  r,
real  k0 
)

Constructor for a ellipsoid radius a (meters), reciprocal flattening r, and central scale factor k0. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). Negative r indicates a prolate spheroid. An exception is thrown if a or k0 is not positive.

Definition at line 59 of file TransverseMercator.cpp.

References STATIC_ASSERT.


Member Function Documentation

void GeographicLib::TransverseMercator::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Convert from latitude lat (degrees) and longitude lon (degrees) to transverse Mercator easting x (meters) and northing y (meters). The central meridian of the transformation is lon0 (degrees). Also return the meridian convergence gamma (degrees) and the scale k. No false easting or northing is added. lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 214 of file TransverseMercator.cpp.

References GeographicLib::Math::asinh(), GeographicLib::Constants::degree(), GeographicLib::Math::hypot(), and GeographicLib::Constants::pi().

Referenced by GeographicLib::UTMUPS::Forward().

void GeographicLib::TransverseMercator::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Convert from transverse Mercator easting x (meters) and northing y (meters) to latitude lat (degrees) and longitude lon (degrees) . The central meridian of the transformation is lon0 (degrees). Also return the meridian convergence gamma (degrees) and the scale k. No false easting or northing is added. lon0 should be in the range [-180, 360]. The value of lon returned is in the range [-180, 180).

Definition at line 384 of file TransverseMercator.cpp.

References GeographicLib::Constants::degree(), GeographicLib::Math::hypot(), and GeographicLib::Constants::pi().

Referenced by GeographicLib::UTMUPS::Reverse().

Math::real GeographicLib::TransverseMercator::MajorRadius (  )  const throw () [inline]

The major radius of the ellipsoid (meters). This is that value of a used in the constructor.

Definition at line 150 of file TransverseMercator.hpp.

Math::real GeographicLib::TransverseMercator::InverseFlattening (  )  const throw () [inline]

The inverse flattening of the ellipsoid. This is that value of r used in the constructor. A value of 0 is returned for a sphere (infinite inverse flattening).

Definition at line 157 of file TransverseMercator.hpp.

Math::real GeographicLib::TransverseMercator::CentralScale (  )  const throw () [inline]

The central scale for the projection. This is that value of k0 used in the constructor and is the scale on the central meridian.

Definition at line 163 of file TransverseMercator.hpp.


Member Data Documentation

A global instantiation of TransverseMercator with the WGS84 ellipsoid and the UTM scale factor. However, unlike UTM, no false easting or northing is added.

Definition at line 170 of file TransverseMercator.hpp.

Referenced by GeographicLib::UTMUPS::Forward(), and GeographicLib::UTMUPS::Reverse().


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

Generated on 21 May 2010 for GeographicLib by  doxygen 1.6.1