/usr/share/doc/geographiclib/html/other.html is in geographiclib-tools 1.21-1ubuntu1.
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 | <!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"/>
<title>GeographicLib: Other interfaces (Javascript, Python, Matlab, Octave)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<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.21</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5 -->
<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>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Other interfaces (Javascript, Python, Matlab, Octave) </div> </div>
</div>
<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>Interfaces to subsets of GeographicLib are available in other languages</p>
<ul>
<li><a class="el" href="other.html#javascript">Javascript interface</a>.</li>
<li><a class="el" href="other.html#python">Python interface</a>.</li>
<li><a class="el" href="other.html#matlab">Matlab and Octave interfaces</a>.</li>
</ul>
<h2><a class="anchor" id="javascript"></a>
Javascript interface</h2>
<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.">GeographicLib::Math</a></li>
<li><a class="el" href="classGeographicLib_1_1Accumulator.html" title="An accumulator for sums.">GeographicLib::Accumulator</a></li>
<li><a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations">GeographicLib::Geodesic</a></li>
<li><a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line.">GeographicLib::GeodesicLine</a></li>
<li><a class="el" href="classGeographicLib_1_1PolygonArea.html" title="Polygon Areas.">GeographicLib::PolygonArea</a></li>
<li><a class="el" href="classGeographicLib_1_1DMS.html" title="Convert between degrees and DMS representation.">GeographicLib::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"><pre class="fragment"><script type=<span class="stringliteral">"text/javascript"</span>
src=<span class="stringliteral">"http://geographiclib.sf.net/scripts/geographiclib.js"</span>>
</script>
</pre></div><p> which loads faster.</p>
<h2><a class="anchor" id="python"></a>
Python interface</h2>
<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). This contains implementations of the classes</p>
<ul>
<li><a class="el" href="classGeographicLib_1_1Math.html" title="Mathematical functions needed by GeographicLib.">GeographicLib::Math</a></li>
<li><a class="el" href="classGeographicLib_1_1Accumulator.html" title="An accumulator for sums.">GeographicLib::Accumulator</a></li>
<li><a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations">GeographicLib::Geodesic</a></li>
<li><a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line.">GeographicLib::GeodesicLine</a></li>
<li><a class="el" href="classGeographicLib_1_1PolygonArea.html" title="Polygon Areas.">GeographicLib::PolygonArea</a></li>
</ul>
<p>You can also download the python interface independent of the rest of GeographicLib 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>
<div class="fragment"><pre class="fragment">
cd geographiclib-1.16
python setup.py install
</pre></div><p> (this will require root privileges). Or else you can set the path within python using </p>
<div class="fragment"><pre class="fragment">>>> <span class="keyword">import</span> sys
>>> sys.path.append(<span class="stringliteral">"/usr/local/lib/python/site-packages"</span>);
</pre></div><p>An example of using this interface is </p>
<div class="fragment"><pre class="fragment">>>> from geographiclib.geodesic <span class="keyword">import</span> Geodesic
>>> # The geodesic inverse problem
... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50)
>>> # The geodesic direct problem
... Geodesic.WGS84.Direct(40.6, -73.8, 45, 10000e3)
>>> # How to obtain several points along a geodesic
... line = Geodesic.WGS84.Line(40.6, -73.8, 45)
>>> line.Position( 5000e3)
>>> line.Position(10000e3)
>>> # Computing the area of a geodesic polygon
... def p(lat,lon): return {<span class="stringliteral">'lat'</span>: lat, <span class="stringliteral">'lon'</span>: lon}
...
>>> Geodesic.WGS84.Area([p(0, 0), p(0, 90), p(90, 0)])
>>> # Introductory help
... help(Geodesic)
</pre></div><p>(Note: The initial version of setup.py was provided by Andrew MacIntyre of the Australian Communications and Media Authority.)</p>
<h2><a class="anchor" id="matlab"></a>
Matlab and Octave interfaces</h2>
<p>The matlab directory contains interface code so that some GeographicLib classes can be accessed from Matlab or Octave. There are two ways of compiling this 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 GeographicLib. For example <div class="fragment"><pre class="fragment">
mex.bat -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2010b\sys\lcc
[2] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
etc. </pre></div> (This will require that mex.bat is in your PATH. With Linux, use <code>mex -setup</code>.) Then configure cmake with, for example <div class="fragment"><pre class="fragment">
cmake -G "Visual Studio 10" -D MATLAB_COMPILER=mex .. </pre></div> 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 GeographicLib with Visual Studio. (The binary installer for 64-bit Windows includes the compiled interface built with Visual Studio 10 and Matlab R2010b 64-bit).<br/>
On Linux systems, you can compile the interface for use with octave instead by using <div class="fragment"><pre class="fragment">
cmake -D MATLAB_COMPILER=mkoctfile .. </pre></div></li>
<li><b>Invoking the compiler from Matlab or Octave:</b> Start Matlab or Octave and run, e.g., <div class="fragment"><pre class="fragment"> mex -setup
cd <span class="stringliteral">'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab'</span>
help geographiclibinterface
geographiclibinterface(<span class="stringliteral">'C:/pkg-vc10/GeographicLib-1.21'</span>);
addpath(pwd);
</pre></div> The first command allows you to select the compiler to use (which should be the same as that used to compile GeographicLib).</li>
</ul>
<p>To use the interface routines for GeographicLib, run one of (for example) </p>
<div class="fragment"><pre class="fragment">
addpath /usr/local/libexec/GeographicLib/matlab
addpath 'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab'
</pre></div><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">GeographicLib::Geodesic::Direct</a>)</li>
<li>geodesicinverse: solve inverse geodesic problem (see <a class="el" href="classGeographicLib_1_1Geodesic.html#ad7e59a242125a35a95c96cdb20573081">GeographicLib::Geodesic::Inverse</a>)</li>
<li>geodesicline: compute points along a geodesic (see <a class="el" href="classGeographicLib_1_1GeodesicLine.html#ac9843cbfff45e8163b78e184a3126d82">GeographicLib::GeodesicLine::Position</a>)</li>
<li>polygonarea: compute area of a geodesic polygon (see <a class="el" href="classGeographicLib_1_1PolygonArea.html" title="Polygon Areas.">GeographicLib::PolygonArea</a>)</li>
<li>utmupsforward: convert geographic coordinates to UTM/UPS (see <a class="el" href="classGeographicLib_1_1UTMUPS.html#a921d6c23e728e0b17651902d43fb56e8">GeographicLib::UTMUPS::Forward</a>)</li>
<li>utmupsreverse: convert UTM/UPS coordinates to geographic (see <a class="el" href="classGeographicLib_1_1UTMUPS.html#aaf417ae6bed6da324aa03fc96ee0dda4">GeographicLib::UTMUPS::Reverse</a>)</li>
<li>mgrsforward: convert UTM/UPS coordinates to MGRS (see <a class="el" href="classGeographicLib_1_1MGRS.html#a91de10ebde478dbb85b3c7d057ff97b9">GeographicLib::MGRS::Forward</a>)</li>
<li>mgrsreverse: convert MGRS coordinates to UTM/UPS (see <a class="el" href="classGeographicLib_1_1MGRS.html#a066b79e78cd85bf4b50df50808bed7e3">GeographicLib::MGRS::Reverse</a>)</li>
<li>geoidheight: compute geoid height (see <a class="el" href="classGeographicLib_1_1Geoid.html#accb63bfbbadae10af79b3a3028a3045a">GeographicLib::Geoid::operator()()</a>)</li>
<li>geocentricforward: convert geographic coordinates to geocentric (see <a class="el" href="classGeographicLib_1_1Geocentric.html#a65320594cad8c03d28beaa409f3d6fae">GeographicLib::Geocentric::Forward</a>)</li>
<li>geocentricreverse: convert geocentric coordinates to geographic (see <a class="el" href="classGeographicLib_1_1Geocentric.html#a1907735ce8f5f915a14a5f7a8b3adfea">GeographicLib::Geocentric::Reverse</a>)</li>
<li>localcartesianforward: convert geographic coordinates to local cartesian (see <a class="el" href="classGeographicLib_1_1LocalCartesian.html#a6426e95f904f224eabedb8fcd17fe537">GeographicLib::LocalCartesian::Forward</a>)</li>
<li>localcartesianreverse: convert local cartesian coordinates to geographic (see <a class="el" href="classGeographicLib_1_1LocalCartesian.html#ac34878de3ae995e7d54f0347a1f34118">GeographicLib::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"><pre class="fragment"> help geodesicdirect
</pre></div><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"><pre class="fragment"> type geodesicdirect
</pre></div><p> Other useful functions, e.g., to convert from geographic coordinates to MGRS 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>
<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>
<hr class="footer"/><address class="footer"><small>
Generated on Tue Apr 24 2012 17:54:16 for GeographicLib by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5
</small></address>
</body>
</html>
|