C library for Geodesics  2.1
Library documentation

To use the library put

#include "geodesic.h"
API for the geodesic routines in C.

in your source code. If you are using the library via PROJ, change this to

#include <geodesic.h>

The documention of the library is given in the header file, geodesic.h. Here is a brief summary of the functions.

Simple geodesic problems:

  • Define a geod_geodesic object and initialize it with geod_init().
  • Call geod_direct() and geod_inverse() to solve the direct and inverse geodesic problems.
  • geod_gendirect() and geod_geninverse() are more general versions of these routines which allow additional quantites, a12, m12, M12, M21, S12, to be computed. You can also specify the distance in the direct problem in terms of the arc length a12, instead of the distance s12 using the GEOD_ARCMODE flag. Additionally you can keep track of how many times a geodsic encircles the ellipsoid with the GEOD_LONG_UNROLL flag.

The library allows multiple points on a single geodesic line (specified by lat1, lon1, and azi1) to be computed efficiently as follows:

Finally, the library provides a way to compute the area of a polygon. The polygon is defined by adding successively either vertices or edges. This is done "progressively", to allow the area to be tracked as the polygon "grows".

You can check the version of the geodesic library with, e.g.,

#if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0)
...
#endif