NETGeographicLib  1.38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
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  * http://geographiclib.sourceforge.net/
11  **********************************************************************/
12 
13 namespace 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="http://dx.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="http://dx.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="http://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="http://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 MajorRadius, 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. If \e f > 1, set flattening
91  * to 1/\e f.
92  * @param[in] k0 central scale factor.
93  * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 is
94  * not positive.
95  **********************************************************************/
96  TransverseMercator(double a, double f, double k0);
97 
98  /**
99  * The default constructor assumes a WGS84 ellipsoid and a UTM scale
100  * factor.
101  **********************************************************************/
103 
104  /**
105  * The destructor calls the finalizer.
106  **********************************************************************/
108  { this->!TransverseMercator(); }
109 
110  /**
111  * Forward projection, from geographic to transverse Mercator.
112  *
113  * @param[in] lon0 central meridian of the projection (degrees).
114  * @param[in] lat latitude of point (degrees).
115  * @param[in] lon longitude of point (degrees).
116  * @param[out] x easting of point (meters).
117  * @param[out] y northing of point (meters).
118  * @param[out] gamma meridian convergence at point (degrees).
119  * @param[out] k scale of projection at point.
120  *
121  * No false easting or northing is added. \e lat should be in the range
122  * [&minus;90&deg;, 90&deg;]; \e lon and \e lon0 should be in the
123  * range [&minus;540&deg;, 540&deg;).
124  **********************************************************************/
125  void Forward(double lon0, double lat, double lon,
126  [System::Runtime::InteropServices::Out] double% x,
127  [System::Runtime::InteropServices::Out] double% y,
128  [System::Runtime::InteropServices::Out] double% gamma,
129  [System::Runtime::InteropServices::Out] double% k);
130 
131  /**
132  * Reverse projection, from transverse Mercator to geographic.
133  *
134  * @param[in] lon0 central meridian of the projection (degrees).
135  * @param[in] x easting of point (meters).
136  * @param[in] y northing of point (meters).
137  * @param[out] lat latitude of point (degrees).
138  * @param[out] lon longitude of point (degrees).
139  * @param[out] gamma meridian convergence at point (degrees).
140  * @param[out] k scale of projection at point.
141  *
142  * No false easting or northing is added. \e lon0 should be in the range
143  * [&minus;540&deg;, 540&deg;). The value of \e lon returned is in
144  * the range [&minus;180&deg;, 180&deg;).
145  **********************************************************************/
146  void Reverse(double lon0, double x, double y,
147  [System::Runtime::InteropServices::Out] double% lat,
148  [System::Runtime::InteropServices::Out] double% lon,
149  [System::Runtime::InteropServices::Out] double% gamma,
150  [System::Runtime::InteropServices::Out] double% k);
151 
152  /**
153  * TransverseMercator::Forward without returning the convergence and scale.
154  **********************************************************************/
155  void Forward(double lon0, double lat, double lon,
156  [System::Runtime::InteropServices::Out] double% x,
157  [System::Runtime::InteropServices::Out] double% y);
158 
159  /**
160  * TransverseMercator::Reverse without returning the convergence and scale.
161  **********************************************************************/
162  void Reverse(double lon0, double x, double y,
163  [System::Runtime::InteropServices::Out] double% lat,
164  [System::Runtime::InteropServices::Out] double% lon);
165 
166  /** \name Inspector functions
167  **********************************************************************/
168  ///@{
169  /**
170  * @return \e a the equatorial radius of the ellipsoid (meters). This is
171  * the value used in the constructor.
172  **********************************************************************/
173  property double MajorRadius { double get(); }
174 
175  /**
176  * @return \e f the flattening of the ellipsoid. This is the value used in
177  * the constructor.
178  **********************************************************************/
179  property double Flattening { double get(); }
180 
181  /**
182  * @return \e k0 central scale for the projection. This is the value of \e
183  * k0 used in the constructor and is the scale on the central meridian.
184  **********************************************************************/
185  property double CentralScale { double get(); }
186  ///@}
187  };
188 } // namespace NETGeographicLib
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, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k)
.NET wrapper for GeographicLib::TransverseMercator.