Debian Codegraph @

man/GeodSolve.1.html

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head><link href="http://search.cpan.org/s/style.css" rel="stylesheet" type="text/css">
5 <title>GeodSolve(1)</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
9
10 <body>
11
12
13
14 <h1 id="NAME">NAME</h1>
15
16 <p>GeodSolve -- perform geodesic calculations</p>
17
18 <h1 id="SYNOPSIS">SYNOPSIS</h1>
19
20 <p><b>GeodSolve</b> [ <b>-i</b> | <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi1</i> | <b>-D</b> <i>lat1</i> <i>lon1</i> <i>azi1</i> <i>s13</i> | <b>-I</b> <i>lat1</i> <i>lon1</i> <i>lat3</i> <i>lon3</i> ] [ <b>-a</b> ] [ <b>-e</b> <i>a</i> <i>f</i> ] [ <b>-u</b> ] [ <b>-F</b> ] [ <b>-d</b> | <b>-:</b> ] [ <b>-w</b> ] [ <b>-b</b> ] [ <b>-f</b> ] [ <b>-p</b> <i>prec</i> ] [ <b>-E</b> ] [ <b>--comment-delimiter</b> <i>commentdelim</i> ] [ <b>--version</b> | <b>-h</b> | <b>--help</b> ] [ <b>--input-file</b> <i>infile</i> | <b>--input-string</b> <i>instring</i> ] [ <b>--line-separator</b> <i>linesep</i> ] [ <b>--output-file</b> <i>outfile</i> ]</p>
21
22 <h1 id="DESCRIPTION">DESCRIPTION</h1>
23
24 <p>The shortest path between two points on the ellipsoid at (<i>lat1</i>, <i>lon1</i>) and (<i>lat2</i>, <i>lon2</i>) is called the geodesic. Its length is <i>s12</i> and the geodesic from point 1 to point 2 has forward azimuths <i>azi1</i> and <i>azi2</i> at the two end points.</p>
25
26 <p><b>GeodSolve</b> operates in one of three modes:</p>
27
28 <ol>
29
30 <li><p>By default, <b>GeodSolve</b> accepts lines on the standard input containing <i>lat1</i> <i>lon1</i> <i>azi1</i> <i>s12</i> and prints <i>lat2</i> <i>lon2</i> <i>azi2</i> on standard output. This is the direct geodesic calculation.</p>
31
32 </li>
33 <li><p>With the <b>-i</b> option, <b>GeodSolve</b> performs the inverse geodesic calculation. It reads lines containing <i>lat1</i> <i>lon1</i> <i>lat2</i> <i>lon2</i> and prints the corresponding values of <i>azi1</i> <i>azi2</i> <i>s12</i>.</p>
34
35 </li>
36 <li><p>Command line arguments <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi1</i> specify a geodesic line. <b>GeodSolve</b> then accepts a sequence of <i>s12</i> values (one per line) on standard input and prints <i>lat2</i> <i>lon2</i> <i>azi2</i> for each. This generates a sequence of points on a single geodesic. Command line arguments <b>-D</b> and <b>-I</b> work similarly with the geodesic line defined in terms of a direct or inverse geodesic calculation, respectively.</p>
37
38 </li>
39 </ol>
40
41 <h1 id="OPTIONS">OPTIONS</h1>
42
43 <dl>
44
45 <dt id="i"><b>-i</b></dt>
46 <dd>
47
48 <p>perform an inverse geodesic calculation (see 2 above).</p>
49
50 </dd>
51 <dt id="L-lat1-lon1-azi1"><b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi1</i></dt>
52 <dd>
53
54 <p>line mode (see 3 above); generate a sequence of points along the geodesic specified by <i>lat1</i> <i>lon1</i> <i>azi1</i>. The <b>-w</b> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before <b>-L</b>.</p>
55
56 </dd>
57 <dt id="D-lat1-lon1-azi1-s13"><b>-D</b> <i>lat1</i> <i>lon1</i> <i>azi1</i> <i>s13</i></dt>
58 <dd>
59
60 <p>line mode (see 3 above); generate a sequence of points along the geodesic specified by <i>lat1</i> <i>lon1</i> <i>azi1</i> <i>s13</i>. The <b>-w</b> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before <b>-D</b>. Similarly, the <b>-a</b> flag can be used to change the interpretation of <i>s13</i> to <i>a13</i>, provided that it appears before <b>-D</b>.</p>
61
62 </dd>
63 <dt id="I-lat1-lon1-lat3-lon3"><b>-I</b> <i>lat1</i> <i>lon1</i> <i>lat3</i> <i>lon3</i></dt>
64 <dd>
65
66 <p>line mode (see 3 above); generate a sequence of points along the geodesic specified by <i>lat1</i> <i>lon1</i> <i>lat3</i> <i>lon3</i>. The <b>-w</b> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before <b>-I</b>.</p>
67
68 </dd>
69 <dt id="a"><b>-a</b></dt>
70 <dd>
71
72 <p>toggle the arc mode flag (it starts off); if this flag is on, then on input <i>and</i> output <i>s12</i> is replaced by <i>a12</i> the arc length (in degrees) on the auxiliary sphere. See <a href="#AUXILIARY-SPHERE">&quot;AUXILIARY SPHERE&quot;</a>.</p>
73
74 </dd>
75 <dt id="e-a-f"><b>-e</b> <i>a</i> <i>f</i></dt>
76 <dd>
77
78 <p>specify the ellipsoid via the equatorial radius, <i>a</i> and the flattening, <i>f</i>. Setting <i>f</i> = 0 results in a sphere. Specify <i>f</i> &lt; 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for <i>f</i>. By default, the WGS84 ellipsoid is used, <i>a</i> = 6378137 m, <i>f</i> = 1/298.257223563.</p>
79
80 </dd>
81 <dt id="u"><b>-u</b></dt>
82 <dd>
83
84 <p>unroll the longitude. Normally, on output longitudes are reduced to lie in [-180deg,180deg). However with this option, the returned longitude <i>lon2</i> is &quot;unrolled&quot; so that <i>lon2</i> - <i>lon1</i> indicates how often and in what sense the geodesic has encircled the earth. Use the <b>-f</b> option, to get both longitudes printed.</p>
85
86 </dd>
87 <dt id="F"><b>-F</b></dt>
88 <dd>
89
90 <p>fractional mode. This only has any effect with the <b>-D</b> and <b>-I</b> options (and is otherwise ignored). The values read on standard input are interpreted as fractional distances to point 3, i.e., as <i>s12</i>/<i>s13</i> instead of <i>s12</i>. If arc mode is in effect, then the values denote fractional arc length, i.e., <i>a12</i>/<i>a13</i>. The fractional distances can be entered as a simple fraction, e.g., 3/4.</p>
91
92 </dd>
93 <dt id="d"><b>-d</b></dt>
94 <dd>
95
96 <p>output angles as degrees, minutes, seconds instead of decimal degrees.</p>
97
98 </dd>
99 <dt id="pod"><b>-:</b></dt>
100 <dd>
101
102 <p>like <b>-d</b>, except use : as a separator instead of the d, &#39;, and &quot; delimiters.</p>
103
104 </dd>
105 <dt id="w"><b>-w</b></dt>
106 <dd>
107
108 <p>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, <i>N</i>, <i>S</i>, <i>E</i>, <i>W</i>).</p>
109
110 </dd>
111 <dt id="b"><b>-b</b></dt>
112 <dd>
113
114 <p>report the <i>back</i> azimuth at point 2 instead of the forward azimuth.</p>
115
116 </dd>
117 <dt id="f"><b>-f</b></dt>
118 <dd>
119
120 <p>full output; each line of output consists of 12 quantities: <i>lat1</i> <i>lon1</i> <i>azi1</i> <i>lat2</i> <i>lon2</i> <i>azi2</i> <i>s12</i> <i>a12</i> <i>m12</i> <i>M12</i> <i>M21</i> <i>S12</i>. <i>a12</i> is described in <a href="#AUXILIARY-SPHERE">&quot;AUXILIARY SPHERE&quot;</a>. The four quantities <i>m12</i>, <i>M12</i>, <i>M21</i>, and <i>S12</i> are described in <a href="#ADDITIONAL-QUANTITIES">&quot;ADDITIONAL QUANTITIES&quot;</a>.</p>
121
122 </dd>
123 <dt id="p-prec"><b>-p</b> <i>prec</i></dt>
124 <dd>
125
126 <p>set the output precision to <i>prec</i> (default 3); <i>prec</i> is the precision relative to 1 m. See <a href="#PRECISION">&quot;PRECISION&quot;</a>.</p>
127
128 </dd>
129 <dt id="E"><b>-E</b></dt>
130 <dd>
131
132 <p>use &quot;exact&quot; algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |<i>f</i>| &gt; 0.02.</p>
133
134 </dd>
135 <dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
136 <dd>
137
138 <p>set the comment delimiter to <i>commentdelim</i> (e.g., &quot;#&quot; or &quot;//&quot;). 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).</p>
139
140 </dd>
141 <dt id="version"><b>--version</b></dt>
142 <dd>
143
144 <p>print version and exit.</p>
145
146 </dd>
147 <dt id="h"><b>-h</b></dt>
148 <dd>
149
150 <p>print usage and exit.</p>
151
152 </dd>
153 <dt id="help"><b>--help</b></dt>
154 <dd>
155
156 <p>print full documentation and exit.</p>
157
158 </dd>
159 <dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
160 <dd>
161
162 <p>read input from the file <i>infile</i> instead of from standard input; a file name of &quot;-&quot; stands for standard input.</p>
163
164 </dd>
165 <dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
166 <dd>
167
168 <p>read input from the string <i>instring</i> instead of from standard input. All occurrences of the line separator character (default is a semicolon) in <i>instring</i> are converted to newlines before the reading begins.</p>
169
170 </dd>
171 <dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
172 <dd>
173
174 <p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>
175
176 </dd>
177 <dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
178 <dd>
179
180 <p>write output to the file <i>outfile</i> instead of to standard output; a file name of &quot;-&quot; stands for standard output.</p>
181
182 </dd>
183 </dl>
184
185 <h1 id="INPUT">INPUT</h1>
186
187 <p><b>GeodSolve</b> measures all angles in degrees, all lengths (<i>s12</i>) in meters, and all areas (<i>S12</i>) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, <code>40d30</code>, <code>40d30&#39;</code>, <code>40:30</code>, <code>40.5d</code>, and <code>40.5</code> are all equivalent. By default, latitude precedes longitude for each point (the <b>-w</b> flag switches this convention); however on input either may be given first by appending (or prepending) <i>N</i> or <i>S</i> to the latitude and <i>E</i> or <i>W</i> to the longitude. Azimuths are measured clockwise from north; however this may be overridden with <i>E</i> or <i>W</i>.</p>
188
189 <p>For details on the allowed formats for angles, see the <code>GEOGRAPHIC COORDINATES</code> section of GeoConvert(1).</p>
190
191 <h1 id="AUXILIARY-SPHERE">AUXILIARY SPHERE</h1>
192
193 <p>Geodesics on the ellipsoid can be transferred to the <i>auxiliary sphere</i> on which the distance is measured in terms of the arc length <i>a12</i> (measured in degrees) instead of <i>s12</i>. In terms of <i>a12</i>, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with <i>a12</i> &gt; 180 degrees do not correspond to shortest paths. With the <b>-a</b> flag, <i>s12</i> (on both input and output) is replaced by <i>a12</i>. The <b>-a</b> flag does <i>not</i> affect the full output given by the <b>-f</b> flag (which always includes both <i>s12</i> and <i>a12</i>).</p>
194
195 <h1 id="ADDITIONAL-QUANTITIES">ADDITIONAL QUANTITIES</h1>
196
197 <p>The <b>-f</b> flag reports four additional quantities.</p>
198
199 <p>The reduced length of the geodesic, <i>m12</i>, is defined such that if the initial azimuth is perturbed by d<i>azi1</i> (radians) then the second point is displaced by <i>m12</i> d<i>azi1</i> in the direction perpendicular to the geodesic. <i>m12</i> is given in meters. On a curved surface the reduced length obeys a symmetry relation, <i>m12</i> + <i>m21</i> = 0. On a flat surface, we have <i>m12</i> = <i>s12</i>.</p>
200
201 <p><i>M12</i> and <i>M21</i> are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance <i>dt</i>, then they are separated by a distance <i>M12</i> <i>dt</i> at point 2. <i>M21</i> is defined similarly (with the geodesics being parallel to one another at point 2). <i>M12</i> and <i>M21</i> are dimensionless quantities. On a flat surface, we have <i>M12</i> = <i>M21</i> = 1.</p>
202
203 <p>If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold:</p>
204
205 <pre><code>s13 = s12 + s23,
206 a13 = a12 + a23,
207 S13 = S12 + S23,
208 m13 = m12 M23 + m23 M21,
209 M13 = M12 M23 - (1 - M12 M21) m23 / m12,
210 M31 = M32 M21 - (1 - M23 M32) m12 / m23.</code></pre>
211
212 <p>Finally, <i>S12</i> 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 (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and (<i>lat2</i>,<i>lon2</i>). It is given in meters^2.</p>
213
214 <h1 id="PRECISION">PRECISION</h1>
215
216 <p><i>prec</i> gives precision of the output with <i>prec</i> = 0 giving 1 m precision, <i>prec</i> = 3 giving 1 mm precision, etc. <i>prec</i> is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is <i>prec</i> + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is <i>prec</i> + 1. The minimum value of <i>prec</i> is 0 and the maximum is 10.</p>
217
218 <h1 id="ERRORS">ERRORS</h1>
219
220 <p>An illegal line of input will print an error message to standard output beginning with <code>ERROR:</code> and causes <b>GeodSolve</b> to return an exit code of 1. However, an error does not cause <b>GeodSolve</b> to terminate; following lines will be converted.</p>
221
222 <h1 id="ACCURACY">ACCURACY</h1>
223
224 <p>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</p>
225
226 <pre><code>|f| error
227 0.01 25 nm
228 0.02 30 nm
229 0.05 10 um
230 0.1 1.5 mm
231 0.2 300 mm</code></pre>
232
233 <p>If <b>-E</b> 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 <i>a/b</i> = 1 - <i>f</i> is</p>
234
235 <pre><code>1-f error (nm)
236 1/128 387
237 1/64 345
238 1/32 269
239 1/16 210
240 1/8 115
241 1/4 69
242 1/2 36
243 1 15
244 2 25
245 4 96
246 8 318
247 16 985
248 32 2352
249 64 6008
250 128 19024</code></pre>
251
252 <h1 id="MULTIPLE-SOLUTIONS">MULTIPLE SOLUTIONS</h1>
253
254 <p>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:</p>
255
256 <dl>
257
258 <dt id="lat1--lat2-with-neither-point-at-a-pole"><i>lat1</i> = -<i>lat2</i> (with neither point at a pole)</dt>
259 <dd>
260
261 <p>If <i>azi1</i> = <i>azi2</i>, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [<i>azi1</i>,<i>azi2</i>] = [<i>azi2</i>,<i>azi1</i>], [<i>M12</i>,<i>M21</i>] = [<i>M21</i>,<i>M12</i>], <i>S12</i> = -<i>S12</i>. (This occurs when the longitude difference is near +/-180 for oblate ellipsoids.)</p>
262
263 </dd>
264 <dt id="lon2-lon1---180-with-neither-point-at-a-pole"><i>lon2</i> = <i>lon1</i> +/- 180 (with neither point at a pole)</dt>
265 <dd>
266
267 <p>If <i>azi1</i> = 0 or +/-180, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [<i>azi1</i>,<i>azi2</i>] = [-<i>azi1</i>,-<i>azi2</i>], <i>S12</i> = -<i>S12</i>. (This occurs when <i>lat2</i> is near -<i>lat1</i> for prolate ellipsoids.)</p>
268
269 </dd>
270 <dt id="Points-1-and-2-at-opposite-poles">Points 1 and 2 at opposite poles</dt>
271 <dd>
272
273 <p>There are infinitely many geodesics which can be generated by setting [<i>azi1</i>,<i>azi2</i>] = [<i>azi1</i>,<i>azi2</i>] + [<i>d</i>,-<i>d</i>], for arbitrary <i>d</i>. (For spheres, this prescription applies when points 1 and 2 are antipodal.)</p>
274
275 </dd>
276 <dt id="s12-0-coincident-points"><i>s12</i> = 0 (coincident points)</dt>
277 <dd>
278
279 <p>There are infinitely many geodesics which can be generated by setting [<i>azi1</i>,<i>azi2</i>] = [<i>azi1</i>,<i>azi2</i>] + [<i>d</i>,<i>d</i>], for arbitrary <i>d</i>.</p>
280
281 </dd>
282 </dl>
283
284 <h1 id="EXAMPLES">EXAMPLES</h1>
285
286 <p>Route from JFK Airport to Singapore Changi Airport:</p>
287
288 <pre><code>echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
289 GeodSolve -i -: -p 0
290
291 003:18:29.9 177:29:09.2 15347628</code></pre>
292
293 <p>Equally spaced waypoints on the route:</p>
294
295 <pre><code>for ((i = 0; i &lt;= 10; ++i)); do echo $i/10; done |
296 GeodSolve -I 40:38:23N 073:46:44W 01:21:33N 103:59:22E -F -: -p 0
297
298 40:38:23.0N 073:46:44.0W 003:18:29.9
299 54:24:51.3N 072:25:39.6W 004:18:44.1
300 68:07:37.7N 069:40:42.9W 006:44:25.4
301 81:38:00.4N 058:37:53.9W 017:28:52.7
302 83:43:26.0N 080:37:16.9E 156:26:00.4
303 70:20:29.2N 097:01:29.4E 172:31:56.4
304 56:38:36.0N 100:14:47.6E 175:26:10.5
305 42:52:37.1N 101:43:37.2E 176:34:28.6
306 29:03:57.0N 102:39:34.8E 177:07:35.2
307 15:13:18.6N 103:22:08.0E 177:23:44.7
308 01:21:33.0N 103:59:22.0E 177:29:09.2</code></pre>
309
310 <h1 id="SEE-ALSO">SEE ALSO</h1>
311
312 <p>GeoConvert(1).</p>
313
314 <p>An online version of this utility is available at <a href="https://geographiclib.sourceforge.io/cgi-bin/GeodSolve">https://geographiclib.sourceforge.io/cgi-bin/GeodSolve</a>.</p>
315
316 <p>The algorithms are described in C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">https://doi.org/10.1007/s00190-012-0578-z</a>.</p>
317
318 <p>The exact routines are covered in C. F. F. Karney, <i>Geodesics on an arbitrary ellipsoid of revolution</i>, J. Geodesy 98, 4:1-14 (2024); DOI: <a href="https://doi.org/10.1007/s00190-023-01813-2">https://doi.org/10.1007/s00190-023-01813-2</a>.</p>
319
320 <p>The Wikipedia page, Geodesics on an ellipsoid, <a href="https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid">https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid</a>.</p>
321
322 <h1 id="AUTHOR">AUTHOR</h1>
323
324 <p><b>GeodSolve</b> was written by Charles Karney.</p>
325
326 <h1 id="HISTORY">HISTORY</h1>
327
328 <p><b>GeodSolve</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in 2009-03. Prior to version 1.30, it was called <b>Geod</b>. (The name was changed to avoid a conflict with the <b>geod</b> utility in <i>proj.4</i>.)</p>
329
330
331 </body>
332
333 </html>
334
335