GeographicLib
2.7
Toggle main menu visibility
Loading...
Searching...
No Matches
PolarStereographic.hpp
Go to the documentation of this file.
1
/**
2
* \file PolarStereographic.hpp
3
* \brief Header for GeographicLib::PolarStereographic class
4
*
5
* Copyright (c) Charles Karney (2008-2022) <karney@alum.mit.edu> and licensed
6
* under the MIT/X11 License. For more information, see
7
* https://geographiclib.sourceforge.io/
8
**********************************************************************/
9
10
#if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP)
11
#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP 1
12
13
#include <
GeographicLib/Constants.hpp
>
14
15
namespace
GeographicLib
{
16
17
/**
18
* \brief Polar stereographic projection
19
*
20
* Implementation taken from the report,
21
* - J. P. Snyder,
22
* <a href="https://pubs.usgs.gov/publication/pp1395"> Map Projections: A
23
* Working Manual</a>, USGS Professional Paper 1395 (1987),
24
* pp. 160--163.
25
*
26
* This is a straightforward implementation of the equations in Snyder except
27
* that Newton's method is used to invert the projection.
28
*
29
* This class also returns the meridian convergence \e gamma and scale \e k.
30
* The meridian convergence is the bearing of grid north (the \e y axis)
31
* measured clockwise from true north.
32
*
33
* Example of use:
34
* \include example-PolarStereographic.cpp
35
**********************************************************************/
36
class
GEOGRAPHICLIB_EXPORT
PolarStereographic
{
37
private
:
38
typedef
Math::real
real;
39
real _a, _f, _e2, _es, _e2m, _c;
40
real _k0;
41
public
:
42
43
/**
44
* Constructor for an ellipsoid with
45
*
46
* @param[in] a equatorial radius (meters).
47
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
48
* Negative \e f gives a prolate ellipsoid.
49
* @param[in] k0 central scale factor.
50
* @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k0 is
51
* not positive.
52
**********************************************************************/
53
PolarStereographic
(real a, real f, real k0);
54
55
/**
56
* Set the scale for the projection.
57
*
58
* @param[in] lat (degrees) assuming \e northp = true.
59
* @param[in] k scale at latitude \e lat (default 1).
60
* @exception GeographicErr \e k is not positive.
61
* @exception GeographicErr if \e lat is not in (−90°,
62
* 90°].
63
**********************************************************************/
64
void
SetScale
(real lat, real k =
real
(1));
65
66
/**
67
* Forward projection, from geographic to polar stereographic.
68
*
69
* @param[in] northp the pole which is the center of projection (true means
70
* north, false means south).
71
* @param[in] lat latitude of point (degrees).
72
* @param[in] lon longitude of point (degrees).
73
* @param[out] x easting of point (meters).
74
* @param[out] y northing of point (meters).
75
* @param[out] gamma meridian convergence at point (degrees).
76
* @param[out] k scale of projection at point.
77
*
78
* No false easting or northing is added. \e lat should be in the range
79
* (−90°, 90°] for \e northp = true and in the range
80
* [−90°, 90°) for \e northp = false.
81
**********************************************************************/
82
void
Forward
(
bool
northp, real lat, real lon,
83
real& x, real& y, real& gamma, real& k)
const
;
84
85
/**
86
* Reverse projection, from polar stereographic to geographic.
87
*
88
* @param[in] northp the pole which is the center of projection (true means
89
* north, false means south).
90
* @param[in] x easting of point (meters).
91
* @param[in] y northing of point (meters).
92
* @param[out] lat latitude of point (degrees).
93
* @param[out] lon longitude of point (degrees).
94
* @param[out] gamma meridian convergence at point (degrees).
95
* @param[out] k scale of projection at point.
96
*
97
* No false easting or northing is added. The value of \e lon returned is
98
* in the range [−180°, 180°].
99
**********************************************************************/
100
void
Reverse
(
bool
northp, real x, real y,
101
real& lat, real& lon, real& gamma, real& k)
const
;
102
103
/**
104
* PolarStereographic::Forward without returning the convergence and scale.
105
**********************************************************************/
106
void
Forward
(
bool
northp, real lat, real lon,
107
real& x, real& y)
const
{
108
real gamma, k;
109
Forward
(northp, lat, lon, x, y, gamma, k);
110
}
111
112
/**
113
* PolarStereographic::Reverse without returning the convergence and scale.
114
**********************************************************************/
115
void
Reverse
(
bool
northp, real x, real y,
116
real& lat, real& lon)
const
{
117
real gamma, k;
118
Reverse
(northp, x, y, lat, lon, gamma, k);
119
}
120
121
/** \name Inspector functions
122
**********************************************************************/
123
///@{
124
/**
125
* @return \e a the equatorial radius of the ellipsoid (meters). This is
126
* the value used in the constructor.
127
**********************************************************************/
128
Math::real
EquatorialRadius
()
const
{
return
_a; }
129
130
/**
131
* @return \e f the flattening of the ellipsoid. This is the value used in
132
* the constructor.
133
**********************************************************************/
134
Math::real
Flattening
()
const
{
return
_f; }
135
136
/**
137
* The central scale for the projection. This is the value of \e k0 used
138
* in the constructor and is the scale at the pole unless overridden by
139
* PolarStereographic::SetScale.
140
**********************************************************************/
141
Math::real
CentralScale
()
const
{
return
_k0; }
142
///@}
143
144
/**
145
* A global instantiation of PolarStereographic with the WGS84 ellipsoid
146
* and the UPS scale factor. However, unlike UPS, no false easting or
147
* northing is added.
148
**********************************************************************/
149
static
const
PolarStereographic
& UPS();
150
};
151
152
}
// namespace GeographicLib
153
154
#endif
// GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP
Constants.hpp
Header for GeographicLib::Constants class.
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition
Constants.hpp:59
real
GeographicLib::Math::real real
Definition
Geod3Solve.cpp:25
GeographicLib::Math::real
double real
Definition
Math.hpp:115
GeographicLib::PolarStereographic
Polar stereographic projection.
Definition
PolarStereographic.hpp:36
GeographicLib::PolarStereographic::Reverse
void Reverse(bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Definition
PolarStereographic.cpp:81
GeographicLib::PolarStereographic::PolarStereographic
PolarStereographic(real a, real f, real k0)
Definition
PolarStereographic.cpp:16
GeographicLib::PolarStereographic::SetScale
void SetScale(real lat, real k=real(1))
Definition
PolarStereographic.cpp:98
GeographicLib::PolarStereographic::EquatorialRadius
Math::real EquatorialRadius() const
Definition
PolarStereographic.hpp:128
GeographicLib::PolarStereographic::CentralScale
Math::real CentralScale() const
Definition
PolarStereographic.hpp:141
GeographicLib::PolarStereographic::Forward
void Forward(bool northp, real lat, real lon, real &x, real &y) const
Definition
PolarStereographic.hpp:106
GeographicLib::PolarStereographic::Flattening
Math::real Flattening() const
Definition
PolarStereographic.hpp:134
GeographicLib::PolarStereographic::Forward
void Forward(bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Definition
PolarStereographic.cpp:61
GeographicLib::PolarStereographic::Reverse
void Reverse(bool northp, real x, real y, real &lat, real &lon) const
Definition
PolarStereographic.hpp:115
GeographicLib
Namespace for GeographicLib.
Definition
Accumulator.cpp:12
include
GeographicLib
PolarStereographic.hpp
Generated by
1.17.0