Static Public Member Functions
GeographicLib::UTMUPS Class Reference

Convert between Geographic coordinates and UTM/UPS. More...

#include <GeographicLib/UTMUPS.hpp>

List of all members.

Static Public Member Functions

static int StandardZone (double lat, double lon) throw ()
static void Forward (double lat, double lon, int &zone, bool &northp, double &x, double &y, double &gamma, double &k, int setzone=-1)
static void Reverse (int zone, bool northp, double x, double y, double &lat, double &lon, double &gamma, double &k)
static void Forward (double lat, double lon, int &zone, bool &northp, double &x, double &y, int setzone=-1)
static void Reverse (int zone, bool northp, double x, double y, double &lat, double &lon)

Detailed Description

Convert between Geographic coordinates and UTM/UPS.

UTM and UPS are defined

Section 2-3 defines UTM and section 3-2.4 defines UPS. This document also includes approximate algorithms for the computation of the underlying transverse Mercator and polar stereographic projections. Here we substitute much more accurate algorithms given by GeographicLib:TransverseMercator and GeographicLib:PolarStereographic.

In this implementation, the conversions are closed, i.e., output from Forward is legal input for Reverse and vice versa. The error is about 5nm in each direction. However, the conversion from legal UTM/UPS coordinates to geographic coordinates and back might throw an error if the initial point is within 5nm of the edge of the allowed range for the UTM/UPS coordinates.

The simplest way to guarantee the closed property is to define allowed ranges for the eastings and northings for UTM and UPS coordinates. The UTM boundaries are the same for all zones. (The only place the exceptional nature of the zone boundaries is evident is when converting to UTM/UPS coordinates requesting the standard zone.) The MGRS lettering scheme imposes natural limits on UTM/UPS coordinates which may be converted into MGRS coordinates. For the conversion to/from geographic coordinates these ranges have been extended by 100km in order to provide a generous overlap between UTM and UPS and between UTM zones.

The NGA software package geotrans also provides conversions to and from UTM and UPS. Version 2.4.2 (and earlier) suffers from some drawbacks:


Member Function Documentation

int GeographicLib::UTMUPS::StandardZone ( double  lat,
double  lon 
) throw () [static]

Return the standard zone for latitude lat (degrees) and longitude lon (degrees). Return 0 if in the standard regions for UPS otherwise return the UTM zone. This includes the Norway and Svalbard exceptions. The tests on latitudes and longitudes are all closed on the lower end open on the upper. Thus for UTM zone 38, latitude is in [-80, 84) and longitude is in [42, 48). This is exact.

Definition at line 48 of file UTMUPS.cpp.

Referenced by GeographicLib::GeoCoords::SetAltZone().

void GeographicLib::UTMUPS::Forward ( double  lat,
double  lon,
int &  zone,
bool &  northp,
double &  x,
double &  y,
double &  gamma,
double &  k,
int  setzone = -1 
) [static]

Convert geographic coordinates to UTM or UPS coordinate. Given latitude lat (degrees), and longitude lon (degrees), return zone (zero indicates UPS), hemisphere northp (false means south, true means north), easting x (meters), and northing y (meters). The prefered zone for the result can be specified with setzone (negative means result of UTMUPS::StandardZone, zero means UPS, positive means a particular UTM zone), Throw error if the resulting easting or northing is outside the allowed range (see Reverse). This also returns meridian convergence gamma (degrees) and scale k. The accuracy of the conversion is about 5nm.

To extent the standard UTM zones into the UPS regions use setzone = UTMUPS::StandardZone(max(-80.0, min(80.0, lat))).

Definition at line 68 of file UTMUPS.cpp.

References GeographicLib::TransverseMercator::Forward(), and GeographicLib::PolarStereographic::Forward().

Referenced by GeographicLib::GeoCoords::Reset(), GeographicLib::GeoCoords::SetAltZone(), and Forward().

void GeographicLib::UTMUPS::Reverse ( int  zone,
bool  northp,
double  x,
double  y,
double &  lat,
double &  lon,
double &  gamma,
double &  k 
) [static]

Convert UTM or UPS coordinate to geographic coordinates . Given zone zone (zone == 0 indicates UPS), hemisphere northp (false means south, true means north), easting x (meters), and northing y (meters), return latitude lat (degrees) and longitude lon (degrees). Throw error if easting or northing is outside the allowed range (see below). This also returns meridian convergence gamma (degrees) and scale k. The accuracy of the conversion is about 5nm.

UTM eastings are allowed to be in the range [0km, 1000km], northings are allowed to be in in [0km, 9600km] for the northern hemisphere and in [900km, 10000km] for the southern hemisphere. (However UTM northings can be continued across the equator. So the actual limits on the northings are [-9100km, 9600km] for the "northern" hemisphere and [900km, 19600km] for the "southern" hemisphere.)

UPS eastings and northings are allowed to be in the range [1200km, 2800km] in the northern hemisphere and in [700km, 3100km] in the southern hemisphere.

These ranges are 100km larger than allowed for the conversions to MGRS. (100km is the maximum extra padding consistent with eastings remaining non-negative.) This allows generous overlaps between zones and UTM and UPS. No checks are performed beyond these (e.g., to limit the distance outside the standard zone boundaries).

Definition at line 109 of file UTMUPS.cpp.

References GeographicLib::TransverseMercator::Reverse(), and GeographicLib::PolarStereographic::Reverse().

Referenced by GeographicLib::GeoCoords::Reset(), GeographicLib::MGRS::Forward(), and Reverse().

static void GeographicLib::UTMUPS::Forward ( double  lat,
double  lon,
int &  zone,
bool &  northp,
double &  x,
double &  y,
int  setzone = -1 
) [inline, static]

Forward without returning convergence and scale.

Definition at line 139 of file UTMUPS.hpp.

References Forward().

static void GeographicLib::UTMUPS::Reverse ( int  zone,
bool  northp,
double  x,
double  y,
double &  lat,
double &  lon 
) [inline, static]

Reverse without returning convergence and scale.

Definition at line 149 of file UTMUPS.hpp.

References Reverse().


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