GeographicLib  1.46
Implementations in other languages
Back to Code organization. Forward to Geoid height. Up to Contents.

Various subsets of GeographicLib have been implemented in other languages. In some cases, these are available as independent packages. Here is a summary:

Some more details are available in the following sections

C and Fortran implementation

This includes the geodesic capabilities of GeographicLib. The source code is in the directories legacy/C and legacy/Fortran. 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.

The C library is also included as part of proj.4 starting with version 4.9.0, where it is used as the computational backend for geod(1).

For documentation, see

It is also possible to call the C++ version of GeographicLib directly from C and the directory wrapper/C contains a small example, which converts heights above the geoid to heights above the ellipsoid.

Java implementation

This includes the geodesic capabilities of GeographicLib. The source code is in the directory 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.

This package is available on Maven Central; so if you're using Apache Maven as your build system, you can use this package by including the dependency

  <dependency>
    <groupId>net.sf.geographiclib</groupId>
    <artifactId>GeographicLib-Java</artifactId>
    <version>1.46</version>
  </dependency>

in your pom.xml.

For documentation, see

JavaScript implementation

This includes the geodesic capabilities of GeographicLib. The source code is in the directory js. This implementation is entirely self-contained and does not depend on the rest of GeographicLib.

The library is available as an npm package. To install this package, use

  npm install geographiclib 

For documentation, see

Examples of using this interface are

Python implementation

This includes the geodesic capabilities of GeographicLib. The source code is in the directory python. This implementation is entirely self-contained and does not depend on the rest of GeographicLib.

The library is available as an PyPI package. To install this package, use

  pip install geographiclib 

For documentation, see

It is also possible to call the C++ version of GeographicLib directly from Python and the directory wrapper/python contains a small example, which converts heights above the geoid to heights above the ellipsoid.

MATLAB and Octave implementations

The includes the geodesic capabilities of GeographicLib and implementations of the TransverseMercator, PolarStereographic, AzimuthalEquidistant, CassiniSoldner, Gnomonic, UTMUPS, MGRS, Geocentric, and LocalCartesian classes. In addition, it includes solutions of the direct, inverse, and area problems for Great Ellipses. Because these functions are all vectorized, their performance is comparable to the C++ routines. The minimum version numbers required are

In addition, in order to use the geoid routines, Octave needs to have been built with a version of GraphicsMagick which supports 16-bit images. The source code is in the directory matlab/geographiclib. This implementation is entirely self-contained and does not depend on the rest of GeographicLib.

The library is available as an MATLAB Central package, GeographicLib toolbox.

A summary of the routines is obtained by

   help geographiclib 

Prior to version 1.42, GeographicLib was distributed with some MATLAB functionality offered via compiled interface code. This has now been replaced by native MATLAB wrapper functions in matlab/geographiclib-legacy; these depend on the GeographicLib toolbox. A summary of the routines is obtained by

   help geographiclib-legacy 

It is also possible to call the C++ version of GeographicLib directly from MATLAB or Octave and the directory wrapper/matlab contains a small example, which solves the inverse geodesic problem for ellipsoids with arbitrary flattening. (This example is taken from the MATLAB interface code which was provided prior to version 1.42.)

.NET wrapper

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

Maxima routines

Maxima is a free computer algebra system which can be downloaded from http://maxima.sourceforge.net. Maxima was used to generate the series used by TransverseMercator (tmseries.mac), Geodesic (geod.mac), Rhumb (rhumbarea.mac), The area under a great ellipse (gearea.mac), the relation between Auxiliary latitudes (auxlat.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.

Back to Code organization. Forward to Geoid height. Up to Contents.