File: GeodSolve.1

package info (click to toggle)
geographiclib 2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,596 kB
  • sloc: cpp: 27,762; sh: 5,463; makefile: 695; python: 12; ansic: 10
file content (414 lines) | stat: -rw-r--r-- 17,665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "GEODSOLVE 1"
.TH GEODSOLVE 1 2025-09-30 "GeographicLib 2.6" "GeographicLib Utilities"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
GeodSolve \-\- perform geodesic calculations
.SH SYNOPSIS
.IX Header "SYNOPSIS"
\&\fBGeodSolve\fR
[ \fB\-i\fR | \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR |
\&\fB\-D\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR | \fB\-I\fR \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR ]
[ \fB\-a\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-u\fR ] [ \fB\-F\fR ]
[ \fB\-d\fR | \fB\-:\fR ] [ \fB\-w\fR ] [ \fB\-b\fR ] [ \fB\-f\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-E\fR ]
[ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ]
[ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ]
[ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ]
[ \fB\-\-line\-separator\fR \fIlinesep\fR ]
[ \fB\-\-output\-file\fR \fIoutfile\fR ]
.SH DESCRIPTION
.IX Header "DESCRIPTION"
The shortest path between two points on the ellipsoid at (\fIlat1\fR,
\&\fIlon1\fR) and (\fIlat2\fR, \fIlon2\fR) is called the geodesic.  Its length is
\&\fIs12\fR and the geodesic from point 1 to point 2 has forward azimuths
\&\fIazi1\fR and \fIazi2\fR at the two end points.
.PP
\&\fBGeodSolve\fR operates in one of three modes:
.IP 1. 4
By default, \fBGeodSolve\fR accepts lines on the standard input containing
\&\fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs12\fR and prints \fIlat2\fR \fIlon2\fR \fIazi2\fR
on standard output.  This is the direct geodesic calculation.
.IP 2. 4
With the \fB\-i\fR option, \fBGeodSolve\fR performs the inverse geodesic
calculation.  It reads lines containing \fIlat1\fR \fIlon1\fR \fIlat2\fR
\&\fIlon2\fR and prints the corresponding values of \fIazi1\fR \fIazi2\fR \fIs12\fR.
.IP 3. 4
Command line arguments \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR specify a geodesic
line.  \fBGeodSolve\fR then accepts a sequence of \fIs12\fR values (one per
line) on standard input and prints \fIlat2\fR \fIlon2\fR \fIazi2\fR for each.
This generates a sequence of points on a single geodesic.  Command line
arguments \fB\-D\fR and \fB\-I\fR work similarly with the geodesic line defined
in terms of a direct or inverse geodesic calculation, respectively.
.SH OPTIONS
.IX Header "OPTIONS"
.IP \fB\-i\fR 4
.IX Item "-i"
perform an inverse geodesic calculation (see 2 above).
.IP "\fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR" 4
.IX Item "-L lat1 lon1 azi1"
line mode (see 3 above); generate a sequence of points along the
geodesic specified by \fIlat1\fR \fIlon1\fR \fIazi1\fR.  The \fB\-w\fR flag can be
used to swap the default order of the 2 geographic coordinates, provided
that it appears before \fB\-L\fR.
.IP "\fB\-D\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR" 4
.IX Item "-D lat1 lon1 azi1 s13"
line mode (see 3 above); generate a sequence of points along the
geodesic specified by \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR.  The \fB\-w\fR flag
can be used to swap the default order of the 2 geographic coordinates,
provided that it appears before \fB\-D\fR.  Similarly, the \fB\-a\fR flag can be
used to change the interpretation of \fIs13\fR to \fIa13\fR, provided that it
appears before \fB\-D\fR.
.IP "\fB\-I\fR \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR" 4
.IX Item "-I lat1 lon1 lat3 lon3"
line mode (see 3 above); generate a sequence of points along the
geodesic specified by \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR.  The \fB\-w\fR flag
can be used to swap the default order of the 2 geographic coordinates,
provided that it appears before \fB\-I\fR.
.IP \fB\-a\fR 4
.IX Item "-a"
toggle the arc mode flag (it starts off); if this flag is on, then on
input \fIand\fR output \fIs12\fR is replaced by \fIa12\fR the arc length (in
degrees) on the auxiliary sphere.  See "AUXILIARY SPHERE".
.IP "\fB\-e\fR \fIa\fR \fIf\fR" 4
.IX Item "-e a f"
specify the ellipsoid via the equatorial radius, \fIa\fR and
the flattening, \fIf\fR.  Setting \fIf\fR = 0 results in a sphere.  Specify
\&\fIf\fR < 0 for a prolate ellipsoid.  A simple fraction, e.g., 1/297,
is allowed for \fIf\fR.  By default, the WGS84 ellipsoid is used, \fIa\fR =
6378137 m, \fIf\fR = 1/298.257223563.
.IP \fB\-u\fR 4
.IX Item "-u"
unroll the longitude.  Normally, on output longitudes are reduced to lie
in [\-180deg,180deg).  However with this option, the returned longitude
\&\fIlon2\fR is "unrolled" so that \fIlon2\fR \- \fIlon1\fR indicates how often and
in what sense the geodesic has encircled the earth.  Use the \fB\-f\fR
option, to get both longitudes printed.
.IP \fB\-F\fR 4
.IX Item "-F"
fractional mode.  This only has any effect with the \fB\-D\fR and \fB\-I\fR
options (and is otherwise ignored).  The values read on standard input
are interpreted as fractional distances to point 3, i.e., as
\&\fIs12\fR/\fIs13\fR instead of \fIs12\fR.  If arc mode is in effect, then the
values denote fractional arc length, i.e., \fIa12\fR/\fIa13\fR.  The
fractional distances can be entered as a simple fraction, e.g., 3/4.
.IP \fB\-d\fR 4
.IX Item "-d"
output angles as degrees, minutes, seconds instead of decimal degrees.
.IP \fB\-:\fR 4
.IX Item "-:"
like \fB\-d\fR, except use : as a separator instead of the d, \*(Aq, and "
delimiters.
.IP \fB\-w\fR 4
.IX Item "-w"
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, \fIN\fR, \fIS\fR, \fIE\fR,
\&\fIW\fR).
.IP \fB\-b\fR 4
.IX Item "-b"
report the \fIback\fR azimuth at point 2 instead of the forward azimuth.
.IP \fB\-f\fR 4
.IX Item "-f"
full output; each line of output consists of 12 quantities: \fIlat1\fR
\&\fIlon1\fR \fIazi1\fR \fIlat2\fR \fIlon2\fR \fIazi2\fR \fIs12\fR \fIa12\fR \fIm12\fR \fIM12\fR
\&\fIM21\fR \fIS12\fR.  \fIa12\fR is described in "AUXILIARY SPHERE".  The four
quantities \fIm12\fR, \fIM12\fR, \fIM21\fR, and \fIS12\fR are described in
"ADDITIONAL QUANTITIES".
.IP "\fB\-p\fR \fIprec\fR" 4
.IX Item "-p prec"
set the output precision to \fIprec\fR (default 3); \fIprec\fR is the
precision relative to 1 m.  See "PRECISION".
.IP \fB\-E\fR 4
.IX Item "-E"
use "exact" algorithms (based on elliptic integrals) for the geodesic
calculations.  These are more accurate than the (default) series
expansions for |\fIf\fR| > 0.02.
.IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4
.IX Item "--comment-delimiter commentdelim"
set the comment delimiter to \fIcommentdelim\fR (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).
.IP \fB\-\-version\fR 4
.IX Item "--version"
print version and exit.
.IP \fB\-h\fR 4
.IX Item "-h"
print usage and exit.
.IP \fB\-\-help\fR 4
.IX Item "--help"
print full documentation and exit.
.IP "\fB\-\-input\-file\fR \fIinfile\fR" 4
.IX Item "--input-file infile"
read input from the file \fIinfile\fR instead of from standard input; a file
name of "\-" stands for standard input.
.IP "\fB\-\-input\-string\fR \fIinstring\fR" 4
.IX Item "--input-string instring"
read input from the string \fIinstring\fR instead of from standard input.
All occurrences of the line separator character (default is a semicolon)
in \fIinstring\fR are converted to newlines before the reading begins.
.IP "\fB\-\-line\-separator\fR \fIlinesep\fR" 4
.IX Item "--line-separator linesep"
set the line separator character to \fIlinesep\fR.  By default this is a
semicolon.
.IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4
.IX Item "--output-file outfile"
write output to the file \fIoutfile\fR instead of to standard output; a
file name of "\-" stands for standard output.
.SH INPUT
.IX Header "INPUT"
\&\fBGeodSolve\fR measures all angles in degrees, all lengths (\fIs12\fR) in
meters, and all areas (\fIS12\fR) in meters^2.  On input angles (latitude,
longitude, azimuth, arc length) can be as decimal degrees or degrees,
minutes, seconds.  For example, \f(CW\*(C`40d30\*(C'\fR, \f(CW\*(C`40d30\*(Aq\*(C'\fR, \f(CW\*(C`40:30\*(C'\fR, \f(CW\*(C`40.5d\*(C'\fR,
and \f(CW40.5\fR are all equivalent.  By default, latitude precedes longitude
for each point (the \fB\-w\fR flag switches this convention); however on
input either may be given first by appending (or prepending) \fIN\fR or
\&\fIS\fR to the latitude and \fIE\fR or \fIW\fR to the longitude.  Azimuths are
measured clockwise from north; however this may be overridden with \fIE\fR
or \fIW\fR.
.PP
For details on the allowed formats for angles, see the \f(CW\*(C`GEOGRAPHIC
COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1).
.SH "AUXILIARY SPHERE"
.IX Header "AUXILIARY SPHERE"
Geodesics on the ellipsoid can be transferred to the \fIauxiliary sphere\fR
on which the distance is measured in terms of the arc length \fIa12\fR
(measured in degrees) instead of \fIs12\fR.  In terms of \fIa12\fR, 180
degrees is the distance from one equator crossing to the next or from
the minimum latitude to the maximum latitude.  Geodesics with \fIa12\fR
> 180 degrees do not correspond to shortest paths.  With the \fB\-a\fR
flag, \fIs12\fR (on both input and output) is replaced by \fIa12\fR.  The
\&\fB\-a\fR flag does \fInot\fR affect the full output given by the \fB\-f\fR flag
(which always includes both \fIs12\fR and \fIa12\fR).
.SH "ADDITIONAL QUANTITIES"
.IX Header "ADDITIONAL QUANTITIES"
The \fB\-f\fR flag reports four additional quantities.
.PP
The reduced length of the geodesic, \fIm12\fR, is defined such that if the
initial azimuth is perturbed by d\fIazi1\fR (radians) then the second point
is displaced by \fIm12\fR d\fIazi1\fR in the direction perpendicular to the
geodesic.  \fIm12\fR is given in meters.  On a curved surface the
reduced length obeys a symmetry relation, \fIm12\fR + \fIm21\fR = 0.  On a
flat surface, we have \fIm12\fR = \fIs12\fR.
.PP
\&\fIM12\fR and \fIM21\fR are geodesic scales.  If two geodesics are parallel at
point 1 and separated by a small distance \fIdt\fR, then they are separated
by a distance \fIM12\fR \fIdt\fR at point 2.  \fIM21\fR is defined similarly
(with the geodesics being parallel to one another at point 2).  \fIM12\fR
and \fIM21\fR are dimensionless quantities.  On a flat surface, we have
\&\fIM12\fR = \fIM21\fR = 1.
.PP
If points 1, 2, and 3 lie on a single geodesic, then the following
addition rules hold:
.PP
.Vb 6
\&   s13 = s12 + s23,
\&   a13 = a12 + a23,
\&   S13 = S12 + S23,
\&   m13 = m12 M23 + m23 M21,
\&   M13 = M12 M23 \- (1 \- M12 M21) m23 / m12,
\&   M31 = M32 M21 \- (1 \- M23 M32) m12 / m23.
.Ve
.PP
Finally, \fIS12\fR 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 geodesic quadrilateral with corners (\fIlat1\fR,\fIlon1\fR), (0,\fIlon1\fR),
(0,\fIlon2\fR), and (\fIlat2\fR,\fIlon2\fR).  It is given in meters^2.
.SH PRECISION
.IX Header "PRECISION"
\&\fIprec\fR gives precision of the output with \fIprec\fR = 0 giving 1 m
precision, \fIprec\fR = 3 giving 1 mm precision, etc.  \fIprec\fR is the
number of digits after the decimal point for lengths.  For decimal
degrees, the number of digits after the decimal point is \fIprec\fR + 5.
For DMS (degree, minute, seconds) output, the number of digits after the
decimal point in the seconds component is \fIprec\fR + 1.  The minimum
value of \fIprec\fR is 0 and the maximum is 10.
.SH ERRORS
.IX Header "ERRORS"
An illegal line of input will print an error message to standard output
beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeodSolve\fR to return an exit code
of 1.  However, an error does not cause \fBGeodSolve\fR to terminate;
following lines will be converted.
.SH ACCURACY
.IX Header "ACCURACY"
Using the (default) series solution, GeodSolve is accurate to about 15
nm (15 nanometers) for the WGS84 ellipsoid.  The approximate maximum
error (expressed as a distance) for an ellipsoid with the same equatorial
radius as the WGS84 ellipsoid and different values of the flattening is
.PP
.Vb 6
\&   |f|     error
\&   0.01    25 nm
\&   0.02    30 nm
\&   0.05    10 um
\&   0.1    1.5 mm
\&   0.2    300 mm
.Ve
.PP
If \fB\-E\fR is specified, GeodSolve is accurate to about 40 nm (40
nanometers) for the WGS84 ellipsoid.  The approximate maximum error
(expressed as a distance) for an ellipsoid with a quarter meridian of
10000 km and different values of the \fIa/b\fR = 1 \- \fIf\fR is
.PP
.Vb 10
\&   1\-f    error (nm)
\&   1/128   387
\&   1/64    345
\&   1/32    269
\&   1/16    210
\&   1/8     115
\&   1/4      69
\&   1/2      36
\&     1      15
\&     2      25
\&     4      96
\&     8     318
\&    16     985
\&    32    2352
\&    64    6008
\&   128   19024
.Ve
.SH "MULTIPLE SOLUTIONS"
.IX Header "MULTIPLE SOLUTIONS"
The shortest distance returned for the inverse problem is (obviously)
uniquely defined.  However, in a few special cases there are multiple
azimuths which yield the same shortest distance.  Here is a catalog of
those cases:
.IP "\fIlat1\fR = \-\fIlat2\fR (with neither point at a pole)" 4
.IX Item "lat1 = -lat2 (with neither point at a pole)"
If \fIazi1\fR = \fIazi2\fR, the geodesic is unique.  Otherwise there are two
geodesics and the second one is obtained by setting [\fIazi1\fR,\fIazi2\fR] =
[\fIazi2\fR,\fIazi1\fR], [\fIM12\fR,\fIM21\fR] = [\fIM21\fR,\fIM12\fR], \fIS12\fR = \-\fIS12\fR.
(This occurs when the longitude difference is near +/\-180 for oblate
ellipsoids.)
.IP "\fIlon2\fR = \fIlon1\fR +/\- 180 (with neither point at a pole)" 4
.IX Item "lon2 = lon1 +/- 180 (with neither point at a pole)"
If \fIazi1\fR = 0 or +/\-180, the geodesic is unique.  Otherwise there are
two geodesics and the second one is obtained by setting
[\fIazi1\fR,\fIazi2\fR] = [\-\fIazi1\fR,\-\fIazi2\fR], \fIS12\fR = \-\fIS12\fR.  (This occurs
when \fIlat2\fR is near \-\fIlat1\fR for prolate ellipsoids.)
.IP "Points 1 and 2 at opposite poles" 4
.IX Item "Points 1 and 2 at opposite poles"
There are infinitely many geodesics which can be generated by setting
[\fIazi1\fR,\fIazi2\fR] = [\fIazi1\fR,\fIazi2\fR] + [\fId\fR,\-\fId\fR], for arbitrary
\&\fId\fR.  (For spheres, this prescription applies when points 1 and 2 are
antipodal.)
.IP "\fIs12\fR = 0 (coincident points)" 4
.IX Item "s12 = 0 (coincident points)"
There are infinitely many geodesics which can be generated by setting
[\fIazi1\fR,\fIazi2\fR] = [\fIazi1\fR,\fIazi2\fR] + [\fId\fR,\fId\fR], for arbitrary \fId\fR.
.SH EXAMPLES
.IX Header "EXAMPLES"
Route from JFK Airport to Singapore Changi Airport:
.PP
.Vb 2
\&   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
\&   GeodSolve \-i \-: \-p 0
\&
\&   003:18:29.9 177:29:09.2 15347628
.Ve
.PP
Equally spaced waypoints on the route:
.PP
.Vb 2
\&   for ((i = 0; i <= 10; ++i)); do echo $i/10; done |
\&   GeodSolve \-I 40:38:23N 073:46:44W 01:21:33N 103:59:22E \-F \-: \-p 0
\&
\&   40:38:23.0N 073:46:44.0W 003:18:29.9
\&   54:24:51.3N 072:25:39.6W 004:18:44.1
\&   68:07:37.7N 069:40:42.9W 006:44:25.4
\&   81:38:00.4N 058:37:53.9W 017:28:52.7
\&   83:43:26.0N 080:37:16.9E 156:26:00.4
\&   70:20:29.2N 097:01:29.4E 172:31:56.4
\&   56:38:36.0N 100:14:47.6E 175:26:10.5
\&   42:52:37.1N 101:43:37.2E 176:34:28.6
\&   29:03:57.0N 102:39:34.8E 177:07:35.2
\&   15:13:18.6N 103:22:08.0E 177:23:44.7
\&   01:21:33.0N 103:59:22.0E 177:29:09.2
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBGeoConvert\fR\|(1).
.PP
An online version of this utility is availbable at
<https://geographiclib.sourceforge.io/cgi\-bin/GeodSolve>.
.PP
The algorithms are described in C. F. F. Karney,
\&\fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); DOI:
<https://doi.org/10.1007/s00190\-012\-0578\-z>;
addenda: <https://geographiclib.sourceforge.io/geod\-addenda.html>.
.PP
The Wikipedia page, Geodesics on an ellipsoid,
<https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid>.
.SH AUTHOR
.IX Header "AUTHOR"
\&\fBGeodSolve\fR was written by Charles Karney.
.SH HISTORY
.IX Header "HISTORY"
\&\fBGeodSolve\fR was added to GeographicLib,
<https://geographiclib.sourceforge.io>, in 2009\-03.  Prior to version
1.30, it was called \fBGeod\fR.  (The name was changed to avoid a conflict
with the \fBgeod\fR utility in \fIproj.4\fR.)