File: Cart3Convert.1.html

package info (click to toggle)
geographiclib 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,572 kB
  • sloc: cpp: 27,765; sh: 5,463; makefile: 695; python: 12; ansic: 10
file content (241 lines) | stat: -rw-r--r-- 12,239 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
<?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>Cart3Convert(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>Cart3Convert -- convert geocentric coordinates for a triaxial ellipsoid</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>Cart3Convert</b> [ <b>-E</b> | <b>-G</b> | <b>-P</b> | <b>-C</b> | <b>-GX</b> | <b>-PX</b> | <b>-CX</b> ] [ <b>-r</b> ] [ <b>-3</b> | <b>-D</b> ] [ <b>-R</b> <i>nrand</i> ] [ <b>--seed</b> <i>s</i> ] [ <b>-t</b> <i>a</i> <i>b</i> <i>c</i> | <b>-e</b> <i>b</i> <i>e2</i> <i>k2</i> <i>kp2</i> ] [ <b>-d</b> | <b>-:</b> ] [ <b>-w</b> ] [ <b>-p</b> <i>prec</i> ] [ <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>Convert coordinates for a triaxial ellipsoid to geocentric coordinates. Geocentric coordinates have the origin at the center of the earth, with the <i>X</i>, <i>Y</i>, and <i>Z</i> axes aligned with the major, median, and minor semiaxes, <i>a</i>, <i>b</i>, and <i>c</i>. By default, the conversion is to geocentric coordinates. Specifying <b>-r</b> causes the reverse conversion to be performed.</p>

<p>Seven latitude/longitude/heading coordinate systems are supported</p>

<ol>

<li><p>Ellipsoidal coordinates, <i>beta</i>, <i>omega</i>, and <i>alpha</i>, signified by <b>-E</b>n (the default)</p>

</li>
<li><p>Geodetic coordinates, <i>phi</i>, <i>lambda</i>, and <i>zeta</i>, signified by <b>-G</b>.</p>

</li>
<li><p>Parametric coordinates, <i>phi&#39;</i>, <i>lambda&#39;</i>, and <i>zeta</i>, signified by <b>-P</b>.</p>

</li>
<li><p>Geocentric coordinates, <i>phi&quot;</i>, <i>lambda&quot;</i>, and <i>zeta</i>, signified by <b>-C</b>.</p>

</li>
<li><p>Geodetic coordinates, <i>phi*</i>, <i>lambda*</i>, and <i>zeta*</i>, with the north pole lying on the <i>X</i> axis, signified by <b>-GX</b>.</p>

</li>
<li><p>Parametric coordinates, <i>phi*&#39;</i>, <i>lambda*&#39;</i>, and <i>zeta*</i>, with the north pole lying on the <i>X</i> axis, signified by <b>-PX</b>.</p>

</li>
<li><p>Geocentric coordinates, <i>phi*&quot;</i>, <i>lambda*&quot;</i>, and <i>zeta*</i>, with the north pole lying on the <i>X</i> axis, signified by <b>-CX</b>.</p>

</li>
</ol>

<p>In general, only ellipsoidal coordinates are orthogonal. However for all coordinates, we define the heading as the direction measured clockwise from a line of constant longitude. <i>zeta</i> is the same for the geodetic, parametric, and geocentric coordinate systems.</p>

<p>Points away from the surface of the ellipsoid can be described by the orthogonal height <i>h</i> above from the ellipsoid and the position is given by <i>phi</i>, <i>lambda</i> (giving the closest point on the ellipsoid), and <i>h</i>. Alternatively, the confocal ellipsoid of minor radius <i>c</i> + <i>H</i> point can be found and the position of the point is then given by <i>beta</i>, <i>omega</i> for the confocal ellipsoid and <i>H</i>.</p>

<p>By default, coordinates are provided on standard input as a set of lines containing (blank separated) <i>latitude</i> and <i>longitude</i> (decimal degrees or degrees, minutes and seconds). The interpretation of the coordinates is governed by the <b>-E</b>, <b>-G</b>, <b>-P</b>, <b>-C</b> <b>-GX</b>, <b>-PX</b>, and <b>-CX</b> flags. For each set of coordinates, the corresponding cartesian coordinates <i>X</i>, <i>Y</i>, <i>Z</i> (meters) are printed on standard output. If <i>-r</i> is provided, the reserve operation is undertaken reading <i>X</i>, <i>Y</i>, <i>Z</i> (which are assumed to denote a point on the ellipsoid) on standard input and printing the <i>latitude</i> and <i>longitude</i>.</p>

<p>If the <b>-3</b> flag is given (this cannot be combined with <b>-D</b>), an arbitrary point in three-dimensional space is specified either with <i>beta</i> <i>omega</i> <i>H</i> or with <i>phi</i> <i>lambda</i> <i>h</i>.</p>

<p>If the <b>-D</b> flag is given (this cannot be combined with <b>-3</b>), the heading (direction) is included in the computation converting <i>beta</i> <i>omega</i> <i>alpha</i> or <i>phi</i> <i>lambda</i> <i>zeta</i> to <i>X</i>, <i>Y</i>, <i>Z</i> <i>Vx</i>, <i>Vy</i>, <i>Vz</i> where [<i>vx</i>, <i>vy</i>, <i>vz</i>] is a unit vector lying in the surface of the ellipsoid.</p>

<p>If the <b>-R</b> flag is given, do not read any input; instead output random cartesian points lying on the surface of the ellipsoid. If the <b>-r</b> flag is specified the cartesian points are converted into one of the triaxial coordinate systems.</p>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="E"><b>-E</b></dt>
<dd>

<p><i>latitude</i> and <i>longitude</i> is interpreted as ellipsoidal coordinates <i>beta</i> and <i>omega</i>. This is the default.</p>

</dd>
<dt id="G-or--GX"><b>-G</b> or <b>-GX</b></dt>
<dd>

<p><i>latitude</i> and <i>longitude</i> is interpreted as geodetic coordinates <i>phi</i> and <i>lambda</i>. The <b>X</b> added to the flags means that the north pole lies on the <i>X</i> axis.</p>

</dd>
<dt id="P-or--PX"><b>-P</b> or <b>-PX</b></dt>
<dd>

<p><i>latitude</i> and <i>longitude</i> is interpreted as parametric coordinates <i>phi&#39;</i> and <i>lambda&#39;</i>. The <b>X</b> added to the flags means that the north pole lies on the <i>X</i> axis.</p>

</dd>
<dt id="C-or--CX"><b>-C</b> or <b>-CX</b></dt>
<dd>

<p><i>latitude</i> and <i>longitude</i> is interpreted as geocentric coordinates <i>phi&quot;</i> and <i>lambda&quot;</i>. The <b>X</b> added to the flags means that the north pole lies on the <i>X</i> axis.</p>

</dd>
<dt id="r"><b>-r</b></dt>
<dd>

<p>perform the reverse projection from <i>x</i>, <i>y</i>, <i>z</i> to <i>latitude</i>, <i>longitude</i>. Unless <b>-3</b> is given, it is assumed that the point lies on the surface of the ellipsoid.</p>

</dd>
<dt id="pod-3"><b>-3</b></dt>
<dd>

<p>include the height <i>h</i> or <i>H</i> in the calculation. This cannot be combined with <b>-D</b>.</p>

</dd>
<dt id="D"><b>-D</b></dt>
<dd>

<p>include the direction <i>alpha</i> or <i>zeta</i> in the calculation. With the <b>-r</b> option, it is assumed that the vector [<i>vx</i>, <i>vy</i>, <i>vz</i>] is tangent to the surface of the ellipsoid. This cannot be combined with <b>-3</b>.</p>

</dd>
<dt id="R-nrand"><b>-R</b> <i>nrand</i></dt>
<dd>

<p>output <i>nrand</i> random points on the surface of the ellipsoid as cartesian coordinates. With <b>-D</b> add also a random cartesian direction tangent to the surface of the ellipsoid. In this mode, nothing is read from standard input. With the <b>-r</b> option the random points are converted into one of the triaxial coordinate systems (and the direction is converted to a heading if <b>-D</b> is given).</p>

</dd>
<dt id="seed-s"><b>--seed</b> <i>s</i></dt>
<dd>

<p>set the random number seed to <i>s</i> when using <b>-R</b>. <i>s</i> = 0 (the default) causes a random seed to be used.</p>

</dd>
<dt id="t-a-b-c"><b>-t</b> <i>a</i> <i>b</i> <i>c</i></dt>
<dd>

<p>specify the ellipsoid via its major semiaxis <i>a</i>, median semiaxis <i>b</i>, and minor semixis <i>c</i>. By default, we have <i>a</i> = 6378172 m, <i>b</i> = 6378102 m, <i>c</i> = 6356752 m, an approximate triaxial model of the earth. (With this model <i>omg</i> = 0deg, corresponds to <i>lon</i> = -14.93deg.</p>

</dd>
<dt id="e-b-e2-k2-kp2"><b>-e</b> <i>b</i> <i>e2</i> <i>k2</i> <i>kp2</i></dt>
<dd>

<p>specify the ellipsoid via the median semiaxis, <i>b</i> and the shape parameters <i>e2</i> = (<i>a</i>^2 - <i>c</i>^2)/<i>b</i>^2, <i>k2</i> = (<i>b</i>^2 - <i>c</i>^2)/(<i>a</i>^2 - <i>c</i>^2), and <i>kp2</i> = (<i>a</i>^2 - <i>b</i>^2)/(<i>a</i>^2 - <i>c</i>^2). Simple fractions are allowed for <i>e2</i>, <i>k2</i>, and <i>kp2</i>. Internally, the supplied values of <i>k2</i> and <i>kp2</i> are normalized so that <i>k2</i> + <i>kp2</i> = 1.</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, &#39;, and &quot; delimiters.</p>

</dd>
<dt id="w"><b>-w</b></dt>
<dd>

<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>

</dd>
<dt id="p-prec"><b>-p</b> <i>prec</i></dt>
<dd>

<p>set the output precision to <i>prec</i> (default 3). For distances, <i>prec</i> 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 <i>prec</i> + 5. For cartesian directions, the precision is <i>prec</i> + 7.</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., &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>

</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 &quot;-&quot; 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 &quot;-&quot; stands for standard output.</p>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<pre><code>echo 1 2 3 | Cart3Convert -t 3 2 1 -3 -p 0 -r
=&gt; 58.69140 75.11263 2.5860649
echo 58.69140 75.11263 2.5860649 | Cart3Convert -t 3 2 1 -3 -p 0
=&gt; 1.0000001 2.0000003 2.9999999</code></pre>

<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>Cart3Convert</b> to return an exit code of 1. However, an error does not cause <b>Cart3Convert</b> to terminate; following lines will be converted.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p><b>Cart3Convert</b> was written by Charles Karney.</p>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>Geod3Solve(1).</p>

<p>The algorithms are described in Appendices A and B of C. F. F. Karney, <i>Jacobi&#39;s solution for geodesics on a triaxial ellipsoid</i>, Technical Report, SRI International, Nov. 2025, <a href="https://arxiv.org/abs/2511.01621">https://arxiv.org/abs/2511.01621</a>.</p>

<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>

<h1 id="HISTORY">HISTORY</h1>

<p><b>Cart3Convert</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in version 2.6.</p>


</body>

</html>