GeographicLib::PolarStereographic Class Reference

Polar stereographic projection. More...

`#include <GeographicLib/PolarStereographic.hpp>`

## Public Member Functions

| PolarStereographic (real a, real f, real k0)
void | SetScale (real lat, real k=real(1))
void | Forward (bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const
void | Reverse (bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const
void | Forward (bool northp, real lat, real lon, real &x, real &y) const
void | Reverse (bool northp, real x, real y, real &lat, real &lon) const
Inspector functions
Math::real | EquatorialRadius () const
Math::real | Flattening () const
Math::real | CentralScale () const

## Static Public Member Functions

static const PolarStereographic & | UPS ()

## Detailed Description

Polar stereographic projection.

Implementation taken from the report,

- J. P. Snyder, Map Projections: A Working Manual, USGS Professional Paper 1395 (1987), pp. 160–163.

This is a straightforward implementation of the equations in Snyder except that Newton's method is used to invert the projection.

This class also returns the meridian convergence gamma and scale k. The meridian convergence is the bearing of grid north (the y axis) measured clockwise from true north.

Example of use:

// Example of using the GeographicLib::PolarStereographic class
#include <iostream>
#include <iomanip>
#include <exception>
#include <GeographicLib/PolarStereographic.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
PolarStereographic proj(Constants::WGS84_a(), Constants::WGS84_f(),
Constants::UPS_k0());
// Alternatively:
// const PolarStereographic& proj = PolarStereographic::UPS();
bool northp = true;
{
// Sample forward calculation
double lat = 61.2, lon = -149.9; // Anchorage
double x, y;
proj.Forward(northp, lat, lon, x, y);
cout << x << " " << y << "\n";
}
{
// Sample reverse calculation
double x = -1637e3, y = 2824e3;
double lat, lon;
proj.Reverse(northp, x, y, lat, lon);
cout << lat << " " << lon << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
main
int main(int argc, const char *const argv[])
Definition: CartConvert.cpp:29
PolarStereographic.hpp
Header for GeographicLib::PolarStereographic class.
GeographicLib::Constants::UPS_k0
static T UPS_k0()
Definition: Constants.hpp:205
GeographicLib::Constants::WGS84_f
static T WGS84_f()
Definition: Constants.hpp:141
GeographicLib::Constants::WGS84_a
static T WGS84_a()
Definition: Constants.hpp:135
GeographicLib::PolarStereographic::PolarStereographic
PolarStereographic(real a, real f, real k0)
Definition: PolarStereographic.cpp:21
GeographicLib
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
std
Definition: NearestNeighbor.hpp:812

Definition at line 36 of file PolarStereographic.hpp.

## Constructor & Destructor Documentation

## PolarStereographic()

GeographicLib::PolarStereographic::PolarStereographic | ( | real | a,
|  | real | f,
|  | real | k0
| ) |  |

Constructor for an ellipsoid with

Parameters

  [in] | a | equatorial radius (meters).
  [in] | f | flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
  [in] | k0 | central scale factor.

Exceptions

  GeographicErr | if a, (1 − f) a, or k0 is not positive.

Definition at line 21 of file PolarStereographic.cpp.

## Member Function Documentation

## SetScale()

void GeographicLib::PolarStereographic::SetScale | ( | real | lat,
|  | real | k = `real(1)`
| ) |  |

Set the scale for the projection.

Parameters

  [in] | lat | (degrees) assuming northp = true.
  [in] | k | scale at latitude lat (default 1).

Exceptions

  GeographicErr | k is not positive.
  GeographicErr | if lat is not in (−90°, 90°].

Definition at line 103 of file PolarStereographic.cpp.

References Forward(), and GeographicLib::Math::qd.

## Forward() [1/2]

void GeographicLib::PolarStereographic::Forward | ( | bool | northp,
|  | real | lat,
|  | real | lon,
|  | real & | x,
|  | real & | y,
|  | real & | gamma,
|  | real & | k
| ) |  | const

Forward projection, from geographic to polar stereographic.

Parameters

  [in] | northp | the pole which is the center of projection (true means north, false means south).
  [in] | lat | latitude of point (degrees).
  [in] | lon | longitude of point (degrees).
  [out] | x | easting of point (meters).
  [out] | y | northing of point (meters).
  [out] | gamma | meridian convergence at point (degrees).
  [out] | k | scale of projection at point.

No false easting or northing is added. lat should be in the range (−90°, 90°] for northp = true and in the range [−90°, 90°) for northp = false.

Definition at line 66 of file PolarStereographic.cpp.

References GeographicLib::Math::AngNormalize(), GeographicLib::Math::LatFix(), GeographicLib::Math::qd, GeographicLib::Math::sincosd(), GeographicLib::Math::sq(), GeographicLib::Math::tand(), and GeographicLib::Math::taupf().

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

## Reverse() [1/2]

void GeographicLib::PolarStereographic::Reverse | ( | bool | northp,
|  | real | x,
|  | real | y,
|  | real & | lat,
|  | real & | lon,
|  | real & | gamma,
|  | real & | k
| ) |  | const

Reverse projection, from polar stereographic to geographic.

Parameters

  [in] | northp | the pole which is the center of projection (true means north, false means south).
  [in] | x | easting of point (meters).
  [in] | y | northing of point (meters).
  [out] | lat | latitude of point (degrees).
  [out] | lon | longitude of point (degrees).
  [out] | gamma | meridian convergence at point (degrees).
  [out] | k | scale of projection at point.

No false easting or northing is added. The value of lon returned is in the range [−180°, 180°].

Definition at line 86 of file PolarStereographic.cpp.

References GeographicLib::Math::AngNormalize(), GeographicLib::Math::atan2d(), GeographicLib::Math::atand(), GeographicLib::Math::sq(), and GeographicLib::Math::tauf().

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

## Forward() [2/2]

void GeographicLib::PolarStereographic::Forward | ( | bool | northp,
|  | real | lat,
|  | real | lon,
|  | real & | x,
|  | real & | y
| ) |  | const

inline

PolarStereographic::Forward without returning the convergence and scale.

Definition at line 106 of file PolarStereographic.hpp.

## Reverse() [2/2]

void GeographicLib::PolarStereographic::Reverse | ( | bool | northp,
|  | real | x,
|  | real | y,
|  | real & | lat,
|  | real & | lon
| ) |  | const

inline

PolarStereographic::Reverse without returning the convergence and scale.

Definition at line 115 of file PolarStereographic.hpp.

## EquatorialRadius()

Math::real GeographicLib::PolarStereographic::EquatorialRadius | ( |  | ) | const

inline

Returns
  a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 128 of file PolarStereographic.hpp.

## Flattening()

Math::real GeographicLib::PolarStereographic::Flattening | ( |  | ) | const

inline

Returns
  f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 134 of file PolarStereographic.hpp.

## CentralScale()

Math::real GeographicLib::PolarStereographic::CentralScale | ( |  | ) | const

inline

The central scale for the projection. This is the value of k0 used in the constructor and is the scale at the pole unless overridden by PolarStereographic::SetScale.

Definition at line 141 of file PolarStereographic.hpp.

## UPS()

const PolarStereographic & GeographicLib::PolarStereographic::UPS | ( |  | ) |

static

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

Definition at line 38 of file PolarStereographic.cpp.

References GeographicLib::Constants::UPS_k0(), GeographicLib::Constants::WGS84_a(), and GeographicLib::Constants::WGS84_f().

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

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

- PolarStereographic.hpp
- PolarStereographic.cpp