00001 #pragma once 00002 /** 00003 * \file NETGeographicLib/TransverseMercator.h 00004 * \brief Header for NETGeographicLib::TransverseMercator class 00005 * 00006 * NETGeographicLib is copyright (c) Scott Heiman (2013) 00007 * GeographicLib is Copyright (c) Charles Karney (2010-2012) 00008 * <charles@karney.com> and licensed under the MIT/X11 License. 00009 * For more information, see 00010 * http://geographiclib.sourceforge.net/ 00011 **********************************************************************/ 00012 00013 namespace NETGeographicLib 00014 { 00015 /** 00016 * \brief .NET wrapper for GeographicLib::TransverseMercator. 00017 * 00018 * This class allows .NET applications to access GeographicLib::TransverseMercator. 00019 * 00020 * This uses Krüger's method which evaluates the projection and its 00021 * inverse in terms of a series. See 00022 * - L. Krüger, 00023 * <a href="http://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme 00024 * Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the 00025 * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New 00026 * Series 52, 172 pp. (1912). 00027 * - C. F. F. Karney, 00028 * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> 00029 * Transverse Mercator with an accuracy of a few nanometers,</a> 00030 * J. Geodesy 85(8), 475--485 (Aug. 2011); 00031 * preprint 00032 * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. 00033 * 00034 * Krüger's method has been extended from 4th to 6th order. The maximum 00035 * error is 5 nm (5 nanometers), ground distance, for all positions within 35 00036 * degrees of the central meridian. The error in the convergence is 2 00037 * × 10<sup>−15</sup>" and the relative error in the scale 00038 * is 6 − 10<sup>−12</sup>%%. See Sec. 4 of 00039 * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details. 00040 * The speed penalty in going to 6th order is only about 1%. 00041 * TransverseMercatorExact is an alternative implementation of the projection 00042 * using exact formulas which yield accurate (to 8 nm) results over the 00043 * entire ellipsoid. 00044 * 00045 * The ellipsoid parameters and the central scale are set in the constructor. 00046 * The central meridian (which is a trivial shift of the longitude) is 00047 * specified as the \e lon0 argument of the TransverseMercator::Forward and 00048 * TransverseMercator::Reverse functions. The latitude of origin is taken to 00049 * be the equator. There is no provision in this class for specifying a 00050 * false easting or false northing or a different latitude of origin. 00051 * However these are can be simply included by the calling function. For 00052 * example, the UTMUPS class applies the false easting and false northing for 00053 * the UTM projections. A more complicated example is the British National 00054 * Grid (<a href="http://www.spatialreference.org/ref/epsg/7405/"> 00055 * EPSG:7405</a>) which requires the use of a latitude of origin. This is 00056 * implemented by the GeographicLib::OSGB class. 00057 * 00058 * See GeographicLib::TransverseMercator.cpp for more information on the 00059 * implementation. 00060 * 00061 * See \ref transversemercator for a discussion of this projection. 00062 * 00063 * C# Example: 00064 * \include example-TransverseMercator.cs 00065 * Managed C++ Example: 00066 * \include example-TransverseMercator.cpp 00067 * Visual Basic Example: 00068 * \include example-TransverseMercator.vb 00069 * 00070 * <B>INTERFACE DIFFERENCES:</B><BR> 00071 * A default constructor is provided that assumes WGS84 parameters and 00072 * a UTM scale factor. 00073 * 00074 * The MajorRadius, Flattening, and CentralScale functions are 00075 * implemented as properties. 00076 **********************************************************************/ 00077 public ref class TransverseMercator 00078 { 00079 private: 00080 // pointer to the unmanaged GeographicLib::TransverseMercator. 00081 const GeographicLib::TransverseMercator* m_pTransverseMercator; 00082 // the finalizer frees the unmanaged memory when the object is destroyed. 00083 !TransverseMercator(void); 00084 public: 00085 /** 00086 * Constructor for a ellipsoid with 00087 * 00088 * @param[in] a equatorial radius (meters). 00089 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. 00090 * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening 00091 * to 1/\e f. 00092 * @param[in] k0 central scale factor. 00093 * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is 00094 * not positive. 00095 **********************************************************************/ 00096 TransverseMercator(double a, double f, double k0); 00097 00098 /** 00099 * The default constructor assumes a WGS84 ellipsoid and a UTM scale 00100 * factor. 00101 **********************************************************************/ 00102 TransverseMercator(); 00103 00104 /** 00105 * The destructor calls the finalizer. 00106 **********************************************************************/ 00107 ~TransverseMercator() 00108 { this->!TransverseMercator(); } 00109 00110 /** 00111 * Forward projection, from geographic to transverse Mercator. 00112 * 00113 * @param[in] lon0 central meridian of the projection (degrees). 00114 * @param[in] lat latitude of point (degrees). 00115 * @param[in] lon longitude of point (degrees). 00116 * @param[out] x easting of point (meters). 00117 * @param[out] y northing of point (meters). 00118 * @param[out] gamma meridian convergence at point (degrees). 00119 * @param[out] k scale of projection at point. 00120 * 00121 * No false easting or northing is added. \e lat should be in the range 00122 * [−90°, 90°]; \e lon and \e lon0 should be in the 00123 * range [−540°, 540°). 00124 **********************************************************************/ 00125 void Forward(double lon0, double lat, double lon, 00126 [System::Runtime::InteropServices::Out] double% x, 00127 [System::Runtime::InteropServices::Out] double% y, 00128 [System::Runtime::InteropServices::Out] double% gamma, 00129 [System::Runtime::InteropServices::Out] double% k); 00130 00131 /** 00132 * Reverse projection, from transverse Mercator to geographic. 00133 * 00134 * @param[in] lon0 central meridian of the projection (degrees). 00135 * @param[in] x easting of point (meters). 00136 * @param[in] y northing of point (meters). 00137 * @param[out] lat latitude of point (degrees). 00138 * @param[out] lon longitude of point (degrees). 00139 * @param[out] gamma meridian convergence at point (degrees). 00140 * @param[out] k scale of projection at point. 00141 * 00142 * No false easting or northing is added. \e lon0 should be in the range 00143 * [−540°, 540°). The value of \e lon returned is in 00144 * the range [−180°, 180°). 00145 **********************************************************************/ 00146 void Reverse(double lon0, double x, double y, 00147 [System::Runtime::InteropServices::Out] double% lat, 00148 [System::Runtime::InteropServices::Out] double% lon, 00149 [System::Runtime::InteropServices::Out] double% gamma, 00150 [System::Runtime::InteropServices::Out] double% k); 00151 00152 /** 00153 * TransverseMercator::Forward without returning the convergence and scale. 00154 **********************************************************************/ 00155 void Forward(double lon0, double lat, double lon, 00156 [System::Runtime::InteropServices::Out] double% x, 00157 [System::Runtime::InteropServices::Out] double% y); 00158 00159 /** 00160 * TransverseMercator::Reverse without returning the convergence and scale. 00161 **********************************************************************/ 00162 void Reverse(double lon0, double x, double y, 00163 [System::Runtime::InteropServices::Out] double% lat, 00164 [System::Runtime::InteropServices::Out] double% lon); 00165 00166 /** \name Inspector functions 00167 **********************************************************************/ 00168 ///@{ 00169 /** 00170 * @return \e a the equatorial radius of the ellipsoid (meters). This is 00171 * the value used in the constructor. 00172 **********************************************************************/ 00173 property double MajorRadius { double get(); } 00174 00175 /** 00176 * @return \e f the flattening of the ellipsoid. This is the value used in 00177 * the constructor. 00178 **********************************************************************/ 00179 property double Flattening { double get(); } 00180 00181 /** 00182 * @return \e k0 central scale for the projection. This is the value of \e 00183 * k0 used in the constructor and is the scale on the central meridian. 00184 **********************************************************************/ 00185 property double CentralScale { double get(); } 00186 ///@} 00187 }; 00188 } // namespace NETGeographicLib