/usr/share/doc/geographiclib/html/other.html is in geographiclib-tools 1.37-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>GeographicLib: Implementations in other languages</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="/usr/share/javascript/mathjax/MathJax.js/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">GeographicLib
 <span id="projectnumber">1.37</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Implementations in other languages </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><center> Back to <a class="el" href="organization.html">Code organization</a>. Forward to <a class="el" href="geoid.html">Geoid height</a>. Up to <a class="el" href="index.html#contents">Contents</a>. </center><p>Implementations of subsets of <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> are available in other languages</p><ul>
<li><a class="el" href="other.html#c-fortran">C and Fortran implementation</a></li>
<li><a class="el" href="other.html#java">Java implementation</a>.</li>
<li><a class="el" href="other.html#javascript">JavaScript implementation</a>.</li>
<li><a class="el" href="other.html#python">Python implementation</a>.</li>
<li><a class="el" href="other.html#matlab">Matlab and Octave implementations</a>.</li>
<li><a class="el" href="other.html#maxima">Maxima routines</a>.</li>
<li><a class="el" href="other.html#dotnet">.NET wrapper</a>.</li>
</ul>
<h1><a class="anchor" id="c-fortran"></a>
C and Fortran implementation</h1>
<p>The directories <code>legacy/C</code> and <code>legacy/Fortran</code> contain implementations of <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a>, <a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a>, and PolygonArea in C and Fortran respectively. These are intended for use in old codes written in these languages and should work any reasonably modern compiler. These implementations are entirely self-contained and do not depend on the rest of <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided.</p>
<p>For documentation, see</p><ul>
<li><a href="C/index.html">C library for geodesics</a>,</li>
<li><a href="Fortran/index.html">Fortran library for geodesics</a>.</li>
</ul>
<h1><a class="anchor" id="java"></a>
Java implementation</h1>
<p>The directory <code>java</code> contains implementations of <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a>, <a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a>, and PolygonArea in Java. This implementation is entirely self-contained and does not depend on the rest of <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided.</p>
<p>For documentation, see</p><ul>
<li><a href="java/index.html">Java library for geodesics</a>.</li>
</ul>
<h1><a class="anchor" id="javascript"></a>
JavaScript implementation</h1>
<p>The directory doc/scripts/GeographicLib contains the classes</p><ul>
<li><a class="el" href="classGeographicLib_1_1Math.html" title="Mathematical functions needed by GeographicLib. ">Math</a></li>
<li><a class="el" href="classGeographicLib_1_1Accumulator.html" title="An accumulator for sums. ">Accumulator</a></li>
<li><a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a></li>
<li><a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a></li>
<li>PolygonArea</li>
<li><a class="el" href="classGeographicLib_1_1DMS.html" title="Convert between degrees and the DMS representation. ">DMS</a></li>
</ul>
<p>translated into JavaScript. See Interface.js for a simple JavaScript interface to these routines (documented near the top of the file). Examples of using this interface are</p><ul>
<li>a <a href="../scripts/geod-calc.html">geodesic calculator</a> showing the solution of direct and inverse geodesic problem, finding intermediate points on a geodesic line, and computing the area of a geodesic polygon.</li>
<li><a href="../scripts/geod-google.html">displaying geodesics in Google Maps</a> which shows the geodesic, the geodesic circle, and various geodesic envelopes.</li>
</ul>
<p>These examples include a "stripped" version of the JavaScript code,</p><div class="fragment"><div class="line"><script type=<span class="stringliteral">"text/javascript"</span></div>
<div class="line"> src=<span class="stringliteral">"http://geographiclib.sf.net/scripts/geographiclib.js"</span>></div>
<div class="line"></script> </div>
</div><!-- fragment --><p> which loads faster.</p>
<h1><a class="anchor" id="python"></a>
Python implementation</h1>
<p>A python implementation of the geodesic routines from <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> are provided in the python/geographiclib directory (which is installed as PREFIX/lib/python/site-packages/geographiclib, if COMMON_INSTALL_PATH is ON, and as PREFIX/python/geographiclib, otherwise). This contains implementations of the classes</p><ul>
<li><a class="el" href="classGeographicLib_1_1Math.html" title="Mathematical functions needed by GeographicLib. ">Math</a></li>
<li><a class="el" href="classGeographicLib_1_1Accumulator.html" title="An accumulator for sums. ">Accumulator</a></li>
<li><a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a></li>
<li><a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a></li>
<li>PolygonArea</li>
</ul>
<p>You can also download the python interface independent of the rest of <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> from</p><ul>
<li><a href="http://pypi.python.org/pypi/geographiclib">http://pypi.python.org/pypi/geographiclib</a></li>
</ul>
<p>and then unpack the .tar.gz or .zip file.</p>
<p>You can "install" these routines, so that they are in python's default path with, for example</p><pre class="fragment"> cd geographiclib-1.16
python setup.py install
</pre><p> (this will require root privileges). Or else you can set the path within python using</p><div class="fragment"><div class="line">>>> <span class="keyword">import</span> sys</div>
<div class="line">>>> sys.path.append(<span class="stringliteral">"/usr/local/lib/python/site-packages"</span>)</div>
</div><!-- fragment --><p>An example of using this interface is</p><div class="fragment"><div class="line">>>> from geographiclib.geodesic <span class="keyword">import</span> Geodesic</div>
<div class="line">>>> # The geodesic inverse problem</div>
<div class="line">... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50)</div>
<div class="line">>>> # The geodesic direct problem</div>
<div class="line">... Geodesic.WGS84.Direct(40.6, -73.8, 45, 10000e3)</div>
<div class="line">>>> # How to obtain several points along a geodesic</div>
<div class="line">... line = Geodesic.WGS84.Line(40.6, -73.8, 45)</div>
<div class="line">>>> line.Position( 5000e3)</div>
<div class="line">>>> line.Position(10000e3)</div>
<div class="line">>>> # Computing the area of a geodesic polygon</div>
<div class="line">... def p(lat,lon): return {<span class="stringliteral">'lat'</span>: lat, <span class="stringliteral">'lon'</span>: lon}</div>
<div class="line">...</div>
<div class="line">>>> Geodesic.WGS84.Area([p(0, 0), p(0, 90), p(90, 0)])</div>
<div class="line">>>> # Introductory help</div>
<div class="line">... help(Geodesic)</div>
</div><!-- fragment --><p>Another illustrative exercise is finding the point midway between JFK Airport to Singapore Changi Airport </p><div class="fragment"><div class="line">from geographiclib.geodesic <span class="keyword">import</span> Geodesic</div>
<div class="line"></div>
<div class="line"><span class="preprocessor"># Coordinates of airports</span></div>
<div class="line">lat1, lon1 = 40.640, -73.779 # JFK</div>
<div class="line">lat2, lon2 = 1.359, 103.989 # SIN</div>
<div class="line"></div>
<div class="line"><span class="preprocessor"># Compute path from 1 to 2</span></div>
<div class="line">g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2)</div>
<div class="line"></div>
<div class="line"><span class="preprocessor"># Compute midpoint starting at 1</span></div>
<div class="line">h = Geodesic.WGS84.Direct(lat1, lon1, g[<span class="stringliteral">'azi1'</span>], g[<span class="stringliteral">'s12'</span>]/2)</div>
<div class="line">print(h[<span class="stringliteral">'lat2'</span>], h[<span class="stringliteral">'lon2'</span>]);</div>
</div><!-- fragment --><p>(Note: The initial version of setup.py was provided by Andrew MacIntyre of the Australian Communications and Media Authority.)</p>
<h1><a class="anchor" id="matlab"></a>
Matlab and Octave implementations</h1>
<p>The <code>matlab</code> directory contains</p><ul>
<li>Native Matlab implementations of the geodesic routines. To use these, start Matlab or Octave and run one of (for example)<pre class="fragment"> addpath /usr/local/libexec/GeographicLib/matlab
addpath 'C:/pkg-vc10-x64/GeographicLib-1.37/libexec/GeographicLib/matlab'</pre> The available functions are:<ul>
<li>geoddoc: briefly descibe the routines</li>
<li>geodreckon: solve the direct geodesic problem</li>
<li>geoddistance: solve the inverse geodesic problem</li>
<li>geodarea: compute the area of ellipsoidal polygons</li>
</ul>
Use the help function to get documentation, e.g.,<div class="fragment"><div class="line">help geoddistance </div>
</div><!-- fragment --> to obtain documentation. These functions are also available as a standalone package from <a href="http://www.mathworks.com/matlabcentral/fileexchange/">Matlab File Exchange</a> using the link<ul>
<li><a href="http://www.mathworks.com/matlabcentral/fileexchange/39108">http://www.mathworks.com/matlabcentral/fileexchange/39108</a></li>
</ul>
</li>
<li>Native Matlab implementations of projections which are related to geodesics. These are<ul>
<li>geodproj: briefly descibe the routines</li>
<li>eqdazim_fwd, eqdazim_inv: azimuthal equidistant</li>
<li>cassini_fwd, cassini_inv: Cassini-Soldner</li>
<li>tranmerc_fwd, tranmerc_inv: transverse Mercator</li>
<li>gnomonic_fwd, gnomonic_inv: ellipsoidal gnomonic</li>
<li>utm_fwd, utm_inv: universal transverse Mercator</li>
</ul>
These functions are also available as a package from <a href="http://www.mathworks.com/matlabcentral/fileexchange/">Matlab File Exchange</a> using the link<ul>
<li><a href="http://www.mathworks.com/matlabcentral/fileexchange/39366">http://www.mathworks.com/matlabcentral/fileexchange/39366</a></li>
</ul>
(This requires that the previous package also be installed.)</li>
<li>Interface code so that some <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> classes can be accessed from Matlab or Octave. The rest of this section describes how to compile and use these interfaces.</li>
</ul>
<p>There are two ways of compiling the interface code: (1) using cmake and (2) invoking the compiler from Matlab.</p><ul>
<li><b>Using cmake:</b> Before running cmake, configure MATLAB on Windows to use the same compiler that you're going to use for compiling <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>. For example<pre class="fragment"> mex.bat -setup
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2012 in C:\Program Files (x86)\Microsoft Visual Studio 11.0
[2] Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
etc. </pre> (This will require that mex.bat is in your PATH. With Linux, use <code>mex -setup</code>.) Then configure cmake with, for example <pre class="fragment"> cmake -G "Visual Studio 10" -D MATLAB_COMPILER=mex ..
cmake --build . --config Release --target matlabinterface </pre> (Note that only the Release configuration is supported for Matlab.) If you are running a 64-bit version of Matlab, be sure to select a 64-bit generator with cmake, e.g., "Visual Studio 10 Win64". Finally compile <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> with Visual Studio. (The binary installer for 64-bit Windows includes the compiled interface built with Visual Studio 10 and Matlab R2013a 64-bit).<br />
On Linux systems, you can compile the interface for use with octave instead by using<pre class="fragment"> cmake -D MATLAB_COMPILER=mkoctfile ..
make matlabinterface </pre></li>
<li><b>Invoking the compiler from Matlab or Octave:</b> Start Matlab or Octave and run, e.g.,<div class="fragment"><div class="line">mex -setup</div>
<div class="line">cd <span class="stringliteral">'C:/pkg-vc10-x64/GeographicLib-1.37/matlab'</span></div>
<div class="line">help geographiclibinterface</div>
<div class="line">geographiclibinterface(<span class="stringliteral">'C:/pkg-vc10/GeographicLib-1.37'</span>);</div>
<div class="line">addpath(pwd);</div>
</div><!-- fragment --> The first command allows you to select the compiler to use (which should be the same as that used to compile <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>).</li>
</ul>
<p>To use the interface routines for <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>, run one of (for example)</p><pre class="fragment"> addpath /usr/local/libexec/GeographicLib/matlab
addpath 'C:/pkg-vc10-x64/GeographicLib-1.37/libexec/GeographicLib/matlab'
</pre><p> in Octave or Matlab. The available functions are:</p><ul>
<li>geodesicdirect: solve direct geodesic problem (see <a class="el" href="classGeographicLib_1_1Geodesic.html#a6e31d7655895a61a49258de00fd14603">Geodesic::Direct</a>)</li>
<li>geodesicinverse: solve inverse geodesic problem (see <a class="el" href="classGeographicLib_1_1Geodesic.html#ad7e59a242125a35a95c96cdb20573081">Geodesic::Inverse</a>)</li>
<li>geodesicline: compute points along a geodesic (see <a class="el" href="classGeographicLib_1_1GeodesicLine.html#ac9843cbfff45e8163b78e184a3126d82">GeodesicLine::Position</a>)</li>
<li>polygonarea: compute area of a geodesic polygon (see PolygonArea)</li>
<li>utmupsforward: convert geographic coordinates to UTM/UPS (see <a class="el" href="classGeographicLib_1_1UTMUPS.html#a921d6c23e728e0b17651902d43fb56e8">UTMUPS::Forward</a>)</li>
<li>utmupsreverse: convert UTM/UPS coordinates to geographic (see <a class="el" href="classGeographicLib_1_1UTMUPS.html#aaf417ae6bed6da324aa03fc96ee0dda4">UTMUPS::Reverse</a>)</li>
<li>mgrsforward: convert UTM/UPS coordinates to <a class="el" href="classGeographicLib_1_1MGRS.html" title="Convert between UTM/UPS and MGRS. ">MGRS</a> (see <a class="el" href="classGeographicLib_1_1MGRS.html#a91de10ebde478dbb85b3c7d057ff97b9">MGRS::Forward</a>)</li>
<li>mgrsreverse: convert <a class="el" href="classGeographicLib_1_1MGRS.html" title="Convert between UTM/UPS and MGRS. ">MGRS</a> coordinates to UTM/UPS (see <a class="el" href="classGeographicLib_1_1MGRS.html#a066b79e78cd85bf4b50df50808bed7e3">MGRS::Reverse</a>)</li>
<li>geoidheight: compute geoid height (see <a class="el" href="classGeographicLib_1_1Geoid.html#accb63bfbbadae10af79b3a3028a3045a">Geoid::operator()()</a>)</li>
<li>geocentricforward: convert geographic coordinates to geocentric (see <a class="el" href="classGeographicLib_1_1Geocentric.html#a65320594cad8c03d28beaa409f3d6fae">Geocentric::Forward</a>)</li>
<li>geocentricreverse: convert geocentric coordinates to geographic (see <a class="el" href="classGeographicLib_1_1Geocentric.html#a1907735ce8f5f915a14a5f7a8b3adfea">Geocentric::Reverse</a>)</li>
<li>localcartesianforward: convert geographic coordinates to local cartesian (see <a class="el" href="classGeographicLib_1_1LocalCartesian.html#a6426e95f904f224eabedb8fcd17fe537">LocalCartesian::Forward</a>)</li>
<li>localcartesianreverse: convert local cartesian coordinates to geographic (see <a class="el" href="classGeographicLib_1_1LocalCartesian.html#ac34878de3ae995e7d54f0347a1f34118">LocalCartesian::Reverse</a>)</li>
</ul>
<p>These routines just offer a simple interface to the corresponding C++ class. Use the help function to get documentation, e.g.,</p><div class="fragment"><div class="line">help geodesicdirect </div>
</div><!-- fragment --><p> Unfortunately, the help function does not work for compiled functions in Octave; in this case, just list the .m file, e.g.,</p><div class="fragment"><div class="line">type geodesicdirect </div>
</div><!-- fragment --><p> Other useful functions, e.g., to convert from geographic coordinates to <a class="el" href="classGeographicLib_1_1MGRS.html" title="Convert between UTM/UPS and MGRS. ">MGRS</a> can easily be written with Matlab code.</p>
<p>Note that geoidheight, when compiled with Visual Studio 2008 causes Matlab to crash. (The problem does not occur with Visual Studio 2005 or Visual Studio 2010.)</p>
<h1><a class="anchor" id="maxima"></a>
Maxima routines</h1>
<p>Maxima is a free computer algebra system which can be downloaded from <a href="http://maxima.sf.net">http://maxima.sf.net</a>. Maxima was used to generate the series used by <a class="el" href="classGeographicLib_1_1TransverseMercator.html" title="Transverse Mercator projection. ">TransverseMercator</a> (<a href="tmseries.mac">tmseries.mac</a>) and <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a> (<a href="geod.mac">geod.mac</a>) and to generate accurate data for testing (<a href="tm.mac">tm.mac</a> and <a href="geodesic.mac">geodesic.mac</a>). The latter uses Maxima's bigfloat arithmetic together with series extended to high order or solutions in terms of elliptic integrals (<a href="ellint.mac">ellint.mac</a>). These files contain brief instructions on how to use them.</p>
<h1><a class="anchor" id="dotnet"></a>
.NET wrapper</h1>
<p>This is a comprehensive wrapper library, written and maintained by Scott Heiman, which exposes all of the functionality of <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> to the .NET family of languages. For documentation, see</p><ul>
<li><a href="NET/index.html">NETGeographicLib .NET wrapper library</a>.</li>
</ul>
<center> Back to <a class="el" href="organization.html">Code organization</a>. Forward to <a class="el" href="geoid.html">Geoid height</a>. Up to <a class="el" href="index.html#contents">Contents</a>. </center> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
|