Implementations of subsets of GeographicLib are available in other languages
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 self-contained 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
java contains implementations of Geodesic, GeodesicLine, and PolygonArea in Java. This implementation is entirely self-contained 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
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/site-packages/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 geographiclib-1.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.)
matlab directory contains
addpath /usr/local/libexec/GeographicLib/matlab addpath 'C:/pkg-vc10-x64/GeographicLib-1.37/libexec/GeographicLib/matlab'The available functions are:
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 MEX-files: Would you like mex to locate installed compilers [y]/n? y Select a compiler:  Microsoft Visual C++ 2012 in C:\Program Files (x86)\Microsoft Visual Studio 11.0  Microsoft Visual C++ 2010 in C:\Program Files (x86)\Microsoft Visual Studio 10.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 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 R2013a 64-bit).
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:/pkg-vc10-x64/GeographicLib-1.37/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