GeographicLib
1.38

Implementations of subsets of GeographicLib are available in other languages
The directories legacy/C
and legacy/Fortran
contain implementations of Geodesic, GeodesicLine, 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 selfcontained and do not depend on the rest of GeographicLib. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided.
For documentation, see
The directory java
contains implementations of Geodesic, GeodesicLine, and PolygonArea in Java. This implementation is entirely selfcontained and does not depend on the rest of GeographicLib. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided.
For documentation, see
The directory doc/scripts/GeographicLib contains the classes
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
These examples include a "stripped" version of the JavaScript code,
which loads faster.
A python implementation of the geodesic routines from GeographicLib are provided in the python/geographiclib directory (which is installed as PREFIX/lib/python/sitepackages/geographiclib, if COMMON_INSTALL_PATH is ON, and as PREFIX/python/geographiclib, otherwise). This contains implementations of the classes
You can also download the python interface independent of the rest of GeographicLib from
and then unpack the .tar.gz or .zip file.
You can "install" these routines, so that they are in python's default path with, for example
cd geographiclib1.16 python setup.py install
(this will require root privileges). Or else you can set the path within python using
An example of using this interface is
Another illustrative exercise is finding the point midway between JFK Airport to Singapore Changi Airport
(Note: The initial version of setup.py was provided by Andrew MacIntyre of the Australian Communications and Media Authority.)
The matlab
directory Matlab and Octave implementations of some of the functions of GeographicLib. To use these, start Matlab or Octave and run one of (for example)
addpath /usr/local/libexec/GeographicLib/matlab addpath 'C:/pkgvc10x64/GeographicLib1.38/libexec/GeographicLib/matlab'
The functions fall into the following groups
There are two ways of compiling the interface code: (1) using cmake and (2) invoking the compiler from Matlab.
mex.bat setup Please choose your compiler for building MEXfiles: 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.(This will require that mex.bat is in your PATH. With Linux, use
mex setup
.) Then configure cmake with, for example cmake G "Visual Studio 10" D MATLAB_COMPILER=mex .. cmake build . config Release target matlabinterface(Note that only the Release configuration is supported for Matlab.) If you are running a 64bit version of Matlab, be sure to select a 64bit generator with cmake, e.g., "Visual Studio 10 Win64". Finally compile GeographicLib with Visual Studio. (The binary installer for 64bit Windows includes the compiled interface built with Visual Studio 10 and Matlab R2013a 64bit).
cmake D MATLAB_COMPILER=mkoctfile .. make matlabinterface
To use the interface routines for GeographicLib, run one of (for example)
addpath /usr/local/libexec/GeographicLib/matlab addpath 'C:/pkgvc10x64/GeographicLib1.38/libexec/GeographicLib/matlab'
in Octave or Matlab. The available functions are:
These routines just offer a simple interface to the corresponding C++ class. Use the help function to get documentation, e.g.,
Unfortunately, the help function does not work for compiled functions in Octave; in this case, just list the .m file, e.g.,
Other useful functions, e.g., to convert from geographic coordinates to MGRS can easily be written with Matlab code.
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.)
Maxima is a free computer algebra system which can be downloaded from http://maxima.sf.net. Maxima was used to generate the series used by TransverseMercator (tmseries.mac) and Geodesic (geod.mac) and to generate accurate data for testing (tm.mac and geodesic.mac). The latter uses Maxima's bigfloat arithmetic together with series extended to high order or solutions in terms of elliptic integrals (ellint.mac). These files contain brief instructions on how to use them.
This is a comprehensive wrapper library, written and maintained by Scott Heiman, which exposes all of the functionality of GeographicLib to the .NET family of languages. For documentation, see