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
|
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>RhumbSolve(1)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<h1 id="NAME">NAME</h1>
<p>RhumbSolve -- perform rhumb line calculations</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<p><b>RhumbSolve</b> [ <b>-i</b> | <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i> ] [ <b>-e</b> <i>a</i> <i>f</i> ] [ <b>-u</b> ] [ <b>-d</b> | <b>-:</b> ] [ <b>-w</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>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>The path with constant heading between two points on the ellipsoid at (<i>lat1</i>, <i>lon1</i>) and (<i>lat2</i>, <i>lon2</i>) is called the rhumb line or loxodrome. Its length is <i>s12</i> and the rhumb line has a forward azimuth <i>azi12</i> along its length. The quantity <i>S12</i> is the area between the rhumb line 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>). The longitude becomes indeterminate when a rhumb line passes through a pole, and <b>RhumbSolve</b> reports NaNs for the longitude and the area in this case.</p>
<p><b>NOTE:</b> the rhumb line is <b>not</b> the shortest path between two points; that is the geodesic and it is calculated by GeodSolve(1).</p>
<p><b>RhumbSolve</b> operates in one of three modes:</p>
<ol>
<li><p>By default, <b>RhumbSolve</b> accepts lines on the standard input containing <i>lat1</i> <i>lon1</i> <i>azi12</i> <i>s12</i> and prints <i>lat2</i> <i>lon2</i> <i>S12</i> on standard output. This is the direct calculation.</p>
</li>
<li><p>With the <b>-i</b> option, <b>RhumbSolve</b> performs the inverse calculation. It reads lines containing <i>lat1</i> <i>lon1</i> <i>lat2</i> <i>lon2</i> and prints the values of <i>azi12</i> <i>s12</i> <i>S12</i> for the corresponding shortest rhumb lines.</p>
</li>
<li><p>Command line arguments <b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i> specify a rhumb line. <b>RhumbSolve</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>S12</i> for each. This generates a sequence of points on a rhumb line.</p>
</li>
</ol>
<h1 id="OPTIONS">OPTIONS</h1>
<dl>
<dt id="i"><b>-i</b></dt>
<dd>
<p>perform an inverse calculation (see 2 above).</p>
</dd>
<dt id="L-lat1-lon1-azi12"><b>-L</b> <i>lat1</i> <i>lon1</i> <i>azi12</i></dt>
<dd>
<p>line mode (see 3 above); generate a sequence of points along the rhumb line specified by <i>lat1</i> <i>lon1</i> <i>azi12</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>
</dd>
<dt id="e-a-f"><b>-e</b> <i>a</i> <i>f</i></dt>
<dd>
<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> < 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>
</dd>
<dt id="u"><b>-u</b></dt>
<dd>
<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 "unrolled" so that <i>lon2</i> - <i>lon1</i> indicates how often and in what sense the geodesic has encircled the earth.</p>
</dd>
<dt id="d"><b>-d</b></dt>
<dd>
<p>output angles as degrees, minutes, seconds instead of decimal degrees.</p>
</dd>
<dt id="pod"><b>-:</b></dt>
<dd>
<p>like <b>-d</b>, except use : as a separator instead of the d, ', and " delimiters.</p>
</dd>
<dt id="w"><b>-w</b></dt>
<dd>
<p>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>
</dd>
<dt id="p-prec"><b>-p</b> <i>prec</i></dt>
<dd>
<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">"PRECISION"</a>.</p>
</dd>
<dt id="E"><b>-E</b></dt>
<dd>
<p>By default, the rhumb line calculations are carried out using series expansions valid for |<i>f</i>| < 0.01. If <b>-E</b> is supplied, exact equations for the rhumb line are used and the area integral is computed with an accurate fit based on this exact equations; these are valid for arbitrary eccentricities.</p>
</dd>
<dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
<dd>
<p>set the comment delimiter to <i>commentdelim</i> (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).</p>
</dd>
<dt id="version"><b>--version</b></dt>
<dd>
<p>print version and exit.</p>
</dd>
<dt id="h"><b>-h</b></dt>
<dd>
<p>print usage and exit.</p>
</dd>
<dt id="help"><b>--help</b></dt>
<dd>
<p>print full documentation and exit.</p>
</dd>
<dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
<dd>
<p>read input from the file <i>infile</i> instead of from standard input; a file name of "-" stands for standard input.</p>
</dd>
<dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
<dd>
<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>
</dd>
<dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
<dd>
<p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>
</dd>
<dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
<dd>
<p>write output to the file <i>outfile</i> instead of to standard output; a file name of "-" stands for standard output.</p>
</dd>
</dl>
<h1 id="INPUT">INPUT</h1>
<p><b>RhumbSolve</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'</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>
<p>For details on the allowed formats for angles, see the <code>GEOGRAPHIC COORDINATES</code> section of GeoConvert(1).</p>
<h1 id="PRECISION">PRECISION</h1>
<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>
<h1 id="ERRORS">ERRORS</h1>
<p>An illegal line of input will print an error message to standard output beginning with <code>ERROR:</code> and causes <b>RhumbSolve</b> to return an exit code of 1. However, an error does not cause <b>RhumbSolve</b> to terminate; following lines will be converted.</p>
<h1 id="ACCURACY">ACCURACY</h1>
<p>The algorithm used by <b>RhumbSolve</b> uses either series expansions or (if <b>-E</b> is specified) exact formulas for computing the rhumb line and the area. These series are formulas are accurate for |<i>f</i>| < 0.01 and the exact formulas apply for any value of the flattening. The computation of rhumb lines and the area involves the ratio of differences and, for nearly east- or west-going rhumb lines, this might result in a large loss of accuracy. However, this problem is avoided by the use of divided differences. For the WGS84 ellipsoid, the error is about 10 nanometers using either method.</p>
<h1 id="EXAMPLES">EXAMPLES</h1>
<p>Route from JFK Airport to Singapore Changi Airport:</p>
<pre><code>echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
RhumbSolve -i -: -p 0
103:34:58.2 18523563 45921660958919</code></pre>
<p>N.B. This is <b>not</b> the route typically taken by aircraft because it's considerably longer than the geodesic given by GeodSolve(1).</p>
<p>Waypoints on the route at intervals of 2000km:</p>
<pre><code>for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |
RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0
40:38:23.0N 073:46:44.0W 0
36:24:30.3N 051:28:26.4W 9817078307821
32:10:26.8N 030:20:57.3W 18224745682005
27:56:13.2N 010:10:54.2W 25358020327741
23:41:50.1N 009:12:45.5E 31321269267102
19:27:18.7N 027:59:22.1E 36195163180159
15:12:40.2N 046:17:01.1E 40041499143669
10:57:55.9N 064:12:52.8E 42906570007050
06:43:07.3N 081:53:28.8E 44823504180200
02:28:16.2N 099:24:54.5E 45813843358737
01:46:36.0S 116:52:59.7E 45888525219677</code></pre>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p>GeoConvert(1), GeodSolve(1).</p>
<p>An online version of this utility is availbable at <a href="https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve">https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve</a>.</p>
<p>An online version of this utility is availbable at <a href="https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve">https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve</a>.</p>
<p>This solution for rhumb line is described in C. F. F. Karney, <i>The area of rhumb polygons</i>, Stud. Geophys. Geod. 68(3--4), 99--120 (2024); DOI <a href="https://doi.org/10.1007/s11200-024-0709-z">https://doi.org/10.1007/s11200-024-0709-z</a>.</p>
<p>The Wikipedia page, Rhumb line, <a href="https://en.wikipedia.org/wiki/Rhumb_line">https://en.wikipedia.org/wiki/Rhumb_line</a>.</p>
<h1 id="AUTHOR">AUTHOR</h1>
<p><b>RhumbSolve</b> was written by Charles Karney.</p>
<h1 id="HISTORY">HISTORY</h1>
<p><b>RhumbSolve</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in version 1.37 and substantially rewritten in version 2.2.</p>
</body>
</html>
|