# Newton’s Method for Solving the Inverse Geodesic Problem in IDL

Posted onThere are a number of approaches to solve the inverse geodesic problem, this post provides the IDL code to use Newton’s method as described by Karney (2012) in ‘Algorithms for geodesics‘.

Assuming the Earth is an ellipsoid, finding the shortest path between two points on the ellipsoid is called a *geodesic*. The inverse geodesic problem finds the shortest path between two points on the ellipsoid, while the direct geodesic problem finds the end point given the starting point, first azimuth and length.

One of the most common approaches to solve the inverse geodesic problem is using Vincenty’s formulae. However, this iterative method can get caught in infinite loops, or can be very slow in a number of cases. Karney’s 2012 paper, ‘Algorithms for geodesics‘ describes how to implement Newton’s Method, which at most takes 16 iterations (typically 2-4), resolves the problem of getting caught in infinite loops and works to a higher degree of accuracy.

Karney’s own site has implementations of the geodesic routines in C++, C, Fortran, Python, Javascript and Matlab. As well as providing an online geodesic solver.

An IDL version, written by myself and Chris Mannix (@chris2306 / chrismannix.com) of the inverse geodesic problem can be downloaded here.

Hope you find it useful!

whoah this blog is fantastic i love reading your articles. Keep up the great work! You know, a lot of people are hunting around for this info, you can help them greatly.