Geodesic calculation library implemented by Mathematica
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This package provides substitute functions for GeoDestination, GeoDistance and GeoDirection, which are built-in functions of Methematica. This package can solve geodesic problems more accurately with arbitrary precision calculation by designating option WorkingPrecision. This package also contains interface to GeographicLib via J/Link.

Although this package and GeographicLib refer to the same paper by Charles F. F. Karney, they differ in the way to calculate. GeographicLib uses functional expansion to calculate elliptic integrals, but this package uses Mathematica built-in functions such as EllipticE. Additionally, inverse function of elliptic integral is represented by InverseFunction, and FindRoot is used to solve the inverse problems numerically. This enables arbitrary precision calculation with Mathematica.

At the moment, accuracy of distance calculation is 0.1 m order for WorkingPrecision->$MachinePrecision and 0.001m order for WorkingPrecision->30. This is much better than GeoDistance[Method->"Vintency75"](10000m order), but less than GeographicLib(GeographicLib has 15nm accuracy).


To install the package,

  • download the zip file,
  • extract,
  • move "Geodesic" directory to the directory Mathematica can find such as $UserBaseDirectory or another one of $Path.


In your Mathematica session,

  • evaluate `<<Geodesic`` to load this package,
  • use like built-in function e.g. GeoDistance2[{lat1, lon1}, {lat2, lon2}],
  • or to use GeographicLib, write GeoDistanceGL[{lat1, lon1}, {lat2, lon2}].


This software is released under the MIT License.