NETGeographicLib 1.52
Loading...
Searching...
No Matches
TransverseMercator.h
Go to the documentation of this file.
1#pragma once
2/**
3 * \file NETGeographicLib/TransverseMercator.h
4 * \brief Header for NETGeographicLib::TransverseMercator class
5 *
6 * NETGeographicLib is copyright (c) Scott Heiman (2013)
7 * GeographicLib is Copyright (c) Charles Karney (2010-2012)
8 * <charles@karney.com> and licensed under the MIT/X11 License.
9 * For more information, see
10 * https://geographiclib.sourceforge.io/
11 **********************************************************************/
12
13namespace NETGeographicLib
14{
15 /**
16 * \brief .NET wrapper for GeographicLib::TransverseMercator.
17 *
18 * This class allows .NET applications to access GeographicLib::TransverseMercator.
19 *
20 * This uses Kr&uuml;ger's method which evaluates the projection and its
21 * inverse in terms of a series. See
22 * - L. Kr&uuml;ger,
23 * <a href="https://doi.org/10.2312/GFZ.b103-krueger28"> Konforme
24 * Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the
25 * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New
26 * Series 52, 172 pp. (1912).
27 * - C. F. F. Karney,
28 * <a href="https://doi.org/10.1007/s00190-011-0445-3">
29 * Transverse Mercator with an accuracy of a few nanometers,</a>
30 * J. Geodesy 85(8), 475--485 (Aug. 2011);
31 * preprint
32 * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
33 *
34 * Kr&uuml;ger's method has been extended from 4th to 6th order. The maximum
35 * error is 5 nm (5 nanometers), ground distance, for all positions within 35
36 * degrees of the central meridian. The error in the convergence is 2
37 * &times; 10<sup>&minus;15</sup>&quot; and the relative error in the scale
38 * is 6 &minus; 10<sup>&minus;12</sup>%%. See Sec. 4 of
39 * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
40 * The speed penalty in going to 6th order is only about 1%.
41 * TransverseMercatorExact is an alternative implementation of the projection
42 * using exact formulas which yield accurate (to 8 nm) results over the
43 * entire ellipsoid.
44 *
45 * The ellipsoid parameters and the central scale are set in the constructor.
46 * The central meridian (which is a trivial shift of the longitude) is
47 * specified as the \e lon0 argument of the TransverseMercator::Forward and
48 * TransverseMercator::Reverse functions. The latitude of origin is taken to
49 * be the equator. There is no provision in this class for specifying a
50 * false easting or false northing or a different latitude of origin.
51 * However these are can be simply included by the calling function. For
52 * example, the UTMUPS class applies the false easting and false northing for
53 * the UTM projections. A more complicated example is the British National
54 * Grid (<a href="http://www.spatialreference.org/ref/epsg/7405/">
55 * EPSG:7405</a>) which requires the use of a latitude of origin. This is
56 * implemented by the GeographicLib::OSGB class.
57 *
58 * See GeographicLib::TransverseMercator.cpp for more information on the
59 * implementation.
60 *
61 * See \ref transversemercator for a discussion of this projection.
62 *
63 * C# Example:
64 * \include example-TransverseMercator.cs
65 * Managed C++ Example:
66 * \include example-TransverseMercator.cpp
67 * Visual Basic Example:
68 * \include example-TransverseMercator.vb
69 *
70 * <B>INTERFACE DIFFERENCES:</B><BR>
71 * A default constructor is provided that assumes WGS84 parameters and
72 * a UTM scale factor.
73 *
74 * The EquatorialRadius, Flattening, and CentralScale functions are
75 * implemented as properties.
76 **********************************************************************/
77 public ref class TransverseMercator
78 {
79 private:
80 // pointer to the unmanaged GeographicLib::TransverseMercator.
81 const GeographicLib::TransverseMercator* m_pTransverseMercator;
82 // the finalizer frees the unmanaged memory when the object is destroyed.
83 !TransverseMercator(void);
84 public:
85 /**
86 * Constructor for a ellipsoid with
87 *
88 * @param[in] a equatorial radius (meters).
89 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
90 * Negative \e f gives a prolate ellipsoid.
91 * @param[in] k0 central scale factor.
92 * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 is
93 * not positive.
94 **********************************************************************/
95 TransverseMercator(double a, double f, double k0);
96
97 /**
98 * The default constructor assumes a WGS84 ellipsoid and a UTM scale
99 * factor.
100 **********************************************************************/
102
103 /**
104 * The destructor calls the finalizer.
105 **********************************************************************/
107 { this->!TransverseMercator(); }
108
109 /**
110 * Forward projection, from geographic to transverse Mercator.
111 *
112 * @param[in] lon0 central meridian of the projection (degrees).
113 * @param[in] lat latitude of point (degrees).
114 * @param[in] lon longitude of point (degrees).
115 * @param[out] x easting of point (meters).
116 * @param[out] y northing of point (meters).
117 * @param[out] gamma meridian convergence at point (degrees).
118 * @param[out] k scale of projection at point.
119 *
120 * No false easting or northing is added. \e lat should be in the range
121 * [&minus;90&deg;, 90&deg;].
122 **********************************************************************/
123 void Forward(double lon0, double lat, double lon,
124 [System::Runtime::InteropServices::Out] double% x,
125 [System::Runtime::InteropServices::Out] double% y,
126 [System::Runtime::InteropServices::Out] double% gamma,
127 [System::Runtime::InteropServices::Out] double% k);
128
129 /**
130 * Reverse projection, from transverse Mercator to geographic.
131 *
132 * @param[in] lon0 central meridian of the projection (degrees).
133 * @param[in] x easting of point (meters).
134 * @param[in] y northing of point (meters).
135 * @param[out] lat latitude of point (degrees).
136 * @param[out] lon longitude of point (degrees).
137 * @param[out] gamma meridian convergence at point (degrees).
138 * @param[out] k scale of projection at point.
139 *
140 * No false easting or northing is added. The value of \e lon returned
141 * is in the range [&minus;180&deg;, 180&deg;).
142 **********************************************************************/
143 void Reverse(double lon0, double x, double y,
144 [System::Runtime::InteropServices::Out] double% lat,
145 [System::Runtime::InteropServices::Out] double% lon,
146 [System::Runtime::InteropServices::Out] double% gamma,
147 [System::Runtime::InteropServices::Out] double% k);
148
149 /**
150 * TransverseMercator::Forward without returning the convergence and scale.
151 **********************************************************************/
152 void Forward(double lon0, double lat, double lon,
153 [System::Runtime::InteropServices::Out] double% x,
154 [System::Runtime::InteropServices::Out] double% y);
155
156 /**
157 * TransverseMercator::Reverse without returning the convergence and scale.
158 **********************************************************************/
159 void Reverse(double lon0, double x, double y,
160 [System::Runtime::InteropServices::Out] double% lat,
161 [System::Runtime::InteropServices::Out] double% lon);
162
163 /** \name Inspector functions
164 **********************************************************************/
165 ///@{
166 /**
167 * @return \e a the equatorial radius of the ellipsoid (meters). This is
168 * the value used in the constructor.
169 **********************************************************************/
170 property double EquatorialRadius { double get(); }
171
172 /**
173 * @return \e f the flattening of the ellipsoid. This is the value used in
174 * the constructor.
175 **********************************************************************/
176 property double Flattening { double get(); }
177
178 /**
179 * @return \e k0 central scale for the projection. This is the value of \e
180 * k0 used in the constructor and is the scale on the central meridian.
181 **********************************************************************/
182 property double CentralScale { double get(); }
183 ///@}
184 };
185} // namespace NETGeographicLib
.NET wrapper for GeographicLib::TransverseMercator.
void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
TransverseMercator(double a, double f, double k0)
void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y)