SYNOPSIS
Geod [ -i | -l lat1 lon1 azi1 ] [ -a ] [ -e a f ] [ -d | -: ] [ -b ] [ -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 the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points.Geod operates in one of three modes:
- 1.
- By default, Geod accepts lines on the standard input containing lat1 lon1 azi1 s12 and prints lat2 lon2 azi2 on standard output. This is the direct geodesic calculation.
- 2.
- Command line arguments -l lat1 lon1 azi1 specify a geodesic line. Geod then accepts a sequence of s12 values (one per line) on standard input and prints lat2 lon2 azi2 for each. This generates a sequence of points on a single geodesic.
- 3.
- With the -i command line argument, Geod performs the inverse geodesic calculation. It reads lines containing lat1 lon1 lat2 lon2 and prints the corresponding values of azi1 azi2 s12.
OPTIONS
- -i
- perform an inverse geodesic calculation (see 3 above).
- -l
- line mode (see 2 above); generate a sequence of points along the geodesic specified by lat1 lon1 azi1.
- -a
- arc mode; on input and output s12 is replaced by a12 the arc length (in degrees) on the auxiliary sphere. See ``AUXILIARY SPHERE''.
- -e
- specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.
- -d
- output angles as degrees, minutes, seconds instead of decimal degrees.
- -:
- like -d, except use : as a separator instead of the d, ', and " delimiters.
- -b
- report the back azimuth at point 2 instead of the forward azimuth.
- -f
- full output; each line of output consists of 12 quantities: lat1 lon1 azi1 lat2 lon2 azi2 s12 a12 m12 M12 M21 S12. a12 is described in ``AUXILIARY SPHERE''. The four quantities m12, M12, M21, and S12 are described in ``ADDITIONAL QUANTITIES''.
- -p
- set the output precision to prec (default 3); prec is the precision relative to 1 m. See PRECISION.
- --comment-delimiter
- 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).
- --version
- print version and exit.
- -h
- print usage and exit.
- --help
- print full documentation and exit.
- --input-file
- read input from the file infile instead of from standard input; a file name of ``-'' stands for standard input.
- --input-string
- 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.
- --line-separator
- set the line separator character to linesep. By default this is a semicolon.
- --output-file
- write output to the file outfile instead of to standard output; a file name of ``-'' stands for standard output.
INPUT
Geod measures all angles in degrees and all lengths (s12) in meters. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees (d), minutes ('), seconds (``). A decimal point can only appear in the least significant component and the designator (d, ', or '') for this component is optional; thus "40d30", "40d30'", "40.5d", and 40.5 are all equivalent. By default, latitude precedes longitude for each point; 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.AUXILIARY SPHERE
Geodesics on the ellipsoid can be transferred to the auxiliary sphere on which the distance is measured in terms of the arc length a12 (measured in degrees) instead of s12. In terms of a12, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with a12 > 180 degrees do not correspond to shortest paths. With the -a flag, s12 (on both input and output) is replaced by a12. The -a flag does not affect the full output given by the -f flag (which always includes both s12 and a12).ADDITIONAL QUANTITIES
The -f flag reports four additional quantities.The reduced length of the geodesic, m12, is defined such that if the initial azimuth is perturbed by dazi1 (radians) then the second point is displaced by m12 dazi1 in the direction perpendicular to the geodesic. m12 is given in meters. On a curved surface the reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we have m12 = s12.
M12 and M21 are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance dt, then they are separated by a distance M12 dt at point 2. M21 is defined similarly (with the geodesics being parallel to one another at point 2). M12 and M21 are dimensionless quantities. On a flat surface, we have M12 = M21 = 1.
If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold, m13 = m12 M23 + m23 M21, M13 = M12 M23 - (1 - M12 M21) m23 / m12, and M31 = M32 M21 - (1 - M23 M32) m12 / m23.
Finally, S12 is the area between the geodesic from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). It is given in meters^2.
PRECISION
prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is 1 + prec. The minimum value of prec is 0 and the maximum is 10.ERRORS
An illegal line of input will print an error message to standard output beginning with "ERROR:" and causes Geod to return an exit code of 1. However, an error does not cause Geod to terminate; following lines will be converted.EXAMPLES
Route from JFK Airport to Singapore Changi Airport:
echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E | Geod -i -: -p 0 003:18:29.9 177:29:09.2 15347628
Waypoints on the route at intervals of 2000km:
for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done | Geod -l 40:38:23N 073:46:44W 003:18:29.9 -: -p 0 40:38:23.0N 073:46:44.0W 003:18:29.9 58:34:45.1N 071:49:36.7W 004:48:48.8 76:22:28.4N 065:32:17.8W 010:41:38.4 84:50:28.0N 075:04:39.2E 150:55:00.9 67:26:20.3N 098:00:51.2E 173:27:20.3 49:33:03.2N 101:06:52.6E 176:07:54.3 31:34:16.5N 102:30:46.3E 177:03:08.4 13:31:56.0N 103:26:50.7E 177:24:55.0 04:32:05.7S 104:14:48.7E 177:28:43.6