Scroll to navigation

GEOD3SOLVE(1) GeographicLib Utilities GEOD3SOLVE(1)

NAME

Geod3Solve -- perform geodesic calculations on a triaxial ellipsoid

SYNOPSIS

Geod3Solve [ -i | -L bet1 omg1 alp1 ] [ -t a b c | -e b e2 k2 kp2 | -e2 b f ] [ -u ] [ -d | -: ] [ -w ] [ -f ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

The shortest path between two points on a triaxial ellipsoid at (bet1, omg1) and (bet2, omg2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has forward azimuths alp1 and alp2 at the two end points. Here bet and omg denote the ellipsoidal latitude, beta, and longitude, omega; alp is an abbreviation of alpha

Geod3Solve operates in one of three modes:

1.
By default, Geod3Solve accepts lines on the standard input containing bet1 omg1 alp1 s12 and prints bet2 omg2 alp2 on standard output. This is the direct geodesic calculation.
2.
With the -i option, Geod3Solve performs the inverse geodesic calculation. It reads lines containing bet1 omg1 bet2 omg2 and prints the corresponding values of alp1 alp2 s12.
3.
Command line arguments -L bet1 omg1 alp1 specify a geodesic line. Geod3Solve then accepts a sequence of s12 values (one per line) on standard input and prints bet2 omg2 alp2 for each. This generates a sequence of points on a single geodesic.

OPTIONS

perform an inverse geodesic calculation (see 2 above).
line mode (see 3 above); generate a sequence of points along the geodesic specified by bet1 omg1 alp1. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -L.
specify the ellipsoid via its major semiaxis a, median semiaxis b, and minor semixis c. By default, we have a = 6378172 m, b = 6378102 m, c = 6356752 m, an approximate triaxial model of the earth. (With this model omg = 0deg, corresponds to lon = -14.93deg.
specify the ellipsoid via the median semiaxis, b and the sphape parameters e2 = (a^2 - c^2)/b^2, k2 = (b^2 - c^2)/(a^2 - c^2), and kp2 = (a^2 - b^2)/(a^2 - c^2). Simple fractions are allowed for e2, k2, and kp2. Internally, the supplied values of k2 and kp2 are normalized so that k2 + kp2 = 1.
specify a biaxial ellipsoid via its equatorial radius b and flattening f. A simple fraction, is allowed for f. In this mode, latitudes are interpreted as geodetic latitudes on both input and output. If f is negative, bet and omg are swapped so that latitude and longitude have their conventional interpretations (e.g., longitude measures the angle about the axis of symmetry).
unroll the latitude and longitude. Normally, on output latitudes and longitudes are reduced to lie in [-90deg,90deg] and [-180deg,180deg) respectively. However with this option, the returned longitude bet2 and omg2 are "unrolled" so that bet2 - bet1 and omg2 - omg1 indicates how often and in what sense the geodesic has encircled the ellipsoid.
output angles as degrees, minutes, seconds instead of decimal degrees.
-:
like -d, except use : as a separator instead of the d, ', and " delimiters.
toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).
full output; each line of output consists of 7 quantities: bet1 omg1 alp1 bet2 omg2 alp2 s12.
set the output precision to prec (default 3). For distances, prec is the number of digits after the decimal point for ellipsoids which are approximately the same size as the Earth; for other ellipsoids the precision is adjusted to retain the same relative precision. For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5. For Cartesian directions, the precision is prec + 7.
set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).
print version and exit.
print usage and exit.
print full documentation and exit.
read input from the file infile instead of from standard input; a file name of "-" stands for standard input.
read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.
set the line separator character to linesep. By default this is a semicolon.
write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

INPUT

Geod3Solve measures all angles in degrees and all lengths (s12) in meters. On input angles (latitude, longitude, azimuth) can be as decimal degrees or degrees, minutes, seconds. For example, "40d30", "40d30'", "40:30", "40.5d", and 40.5 are all equivalent. By default, latitude precedes longitude for each point (the -w flag switches this convention); however on input either may be given first by appending (or prepending) N or S to the latitude and E or W to the longitude. Azimuths are measured clockwise from north; however this may be overridden with E or W.

For details on the allowed formats for angles, see the "GEOGRAPHIC COORDINATES" section of GeoConvert(1).

ERRORS

An illegal line of input will print an error message to standard output beginning with "ERROR:" and causes Geod3Solve to return an exit code of 1. However, an error does not cause Geod3Solve to terminate; following lines will be converted.

EXAMPLES

Route from JFK Airport to Singapore Changi Airport on a triaxial ellipsoid:

  echo 40:38:23N 073:46:44W-19.43W X 01:21:33N 103:59:22E-19.43W |
    tr X '\n' |
    tools/Cart3Convert -G | tools/Cart3Convert -E -r | tr '\n' ' ' |
    tools/Geod3Solve -i -: -p 0
  => 003:15:05.9 177:27:09.0 15339505

The steps here are shift for longitude of major axis (-19.43d), convert to geocentric for biaxial Earth, convert to ellipsoidal for triaxial Earth, compute geodesic distance.

SEE ALSO

Cart3Convert(1).

The Wikipedia page, Geodesics on an ellipsoid, <https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid>.

AUTHOR

Geod3Solve was written by Charles Karney.

HISTORY

Geod3Solve was added to GeographicLib, <https://geographiclib.sourceforge.io>, in version 2.6.

2025-09-30 GeographicLib 2.6