Geodesic calculations for an ellipsoid done right

This page illustrates the geodesic routines available in GeographicLib. The C++ code has been converted to JavaScript so the calculations are carried out on the client. The algorithms are considerably more accurate than Vincenty's method, and offer more functionality (an inverse method which never fails to converge, differential properties of the geodesic, and the area under a geodesic). The algorithms are derived in

Charles F. F. Karney,
Algorithms for geodesics,
J. Geodesy 87(1), 43–55 (Jan. 2013);
DOI: 10.1007/s00190-012-0578-z (pdf); addenda: geod-addenda.html.
This page just provides a basic interface. Enter latitudes, longitudes, and azimuths as degrees and distances as meters using spaces or commas as separators. (Angles may be entered as decimal degrees or as degrees, minutes, and seconds, e.g. -20.51125, 20°30′40.5″S, S20d30'40.5", or -20:30:40.5.) The results are accurate to about 15 nanometers (or 0.1 m2 per vertex for areas). A slicker page where the geodesics are incorporated into Google Maps is given here.

Jump to:


Inverse problem

Find the shortest path between two points on the earth. The path is characterized by its length s12 and its azimuth at the two ends azi1 and azi2. The sample calculation finds the shortest path between Wellington, New Zealand, and Salamanca, Spain. (For this example, the NGS inverse geodesic calculator returns a result which is 1.2 km too long with an azimuth which is off by 3 degrees.) To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 lat2 lon2”:

input:

Output format:   
Output precision:  

status:

lat1 lon1 azi1:

lat2 lon2 azi2:

s12:


Direct problem

Find the destination traveling a given distance along a geodesic with a given azimuth at the starting point. The destination is characterized by its position lat2, lon2 and its azimuth at the destination azi2. The sample calculation shows the result of travelling 10000 km NE from JFK airport. To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 azi1 s12”:

input:

Output format:   
Output precision:  

status:

lat1 lon1 azi1:

lat2 lon2 azi2:

s12:


Geodesic path

Find intermediate points along a geodesic. In addition to specifying the endpoints, give ds12, the maximum distance between the intermediate points and maxk, the maximum number of intervals the geodesic is broken into. The output gives a sequence of positions lat, lon together with the corresponding azimuths azi. The sample shows the path from JFK to Singapore's Changi Airport at about 1000 km intervals. (In this example, the path taken by Google Earth deviates from the shortest path by about 2.9 km.) To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 lat2 lon2 ds12 maxk”:

input:

Output format:   
Output precision:  

status:

points (lat lon azi):


Polygon area

Find the perimeter and area of a polygon whose sides are geodesics. The polygon must be simple (i.e., must not intersect itself). (There's no need to ensure that the polygon is closed.) Counter-clockwise traversal of the polygon results in a positive area. The polygon can encircle one or both poles. The sample gives the approximate perimeter (in m) and area (in m2) of Antarctica. (For this example, Google Earth Pro returns an area which is 30 times too large! However this is a little unfair, since Google Earth has no concept of polygons which encircle a pole.) If the polyline option is selected then just the length of the line joining the points is is returned. To perform the calculation, press the “COMPUTE” button.

Enter points, one per line, as “lat lon”:

points (lat lon):

Treat points as:   

status:

number perimeter area:


Charles Karney <charles@karney.com> (2011-08-04)

SourceForge.net