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
|
.\" -*- 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 "CART3CONVERT 1"
.TH CART3CONVERT 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
Cart3Convert \-\- convert geocentric coordinates for a triaxial ellipsoid
.SH SYNOPSIS
.IX Header "SYNOPSIS"
\&\fBCart3Convert\fR [ \fB\-E\fR | \fB\-G\fR | \fB\-P\fR | \fB\-C\fR | \fB\-GX\fR | \fB\-PX\fR | \fB\-CX\fR ]
[ \fB\-r\fR ] [ \fB\-3\fR | \fB\-D\fR ]
[ \fB\-R\fR \fInrand\fR ] [ \fB\-\-seed\fR \fIs\fR ]
[ \fB\-t\fR \fIa\fR \fIb\fR \fIc\fR | \fB\-e\fR \fIb\fR \fIe2\fR \fIk2\fR \fIkp2\fR ]
[ \fB\-d\fR | \fB\-:\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\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"
Convert coordinates for a triaxial ellipsoid to geocentric coordinates.
Geocentric coordinates have the origin at the center of the earth, with
the \fIX\fR, \fIY\fR, and \fIZ\fR axes aligned with the major, median, and minor
semi\-axes, \fIa\fR, \fIb\fR, and \fIc\fR. By default, the conversion is to
geocentric coordinates. Specifying \fB\-r\fR causes the reverse conversion
to be performed.
.PP
Seven latitude/longitude/heading coordinate systems are supported
.IP 1. 4
Ellipsoidal coordinates, \fIbeta\fR, \fIomega\fR, and \fIalpha\fR, signified by
\&\fB\-E\fRn (the default)
.IP 2. 4
Geodetic coordinates, \fIphi\fR, \fIlambda\fR, and \fIzeta\fR, signified by
\&\fB\-G\fR.
.IP 3. 4
Parametric coordinates, \fIphi\*(Aq\fR, \fIlambda\*(Aq\fR, and \fIzeta\fR, signified by
\&\fB\-P\fR.
.IP 4. 4
Geocentric coordinates, \fIphi"\fR, \fIlambda"\fR, and \fIzeta\fR, signified by
\&\fB\-C\fR.
.IP 5. 4
Geodetic coordinates, \fIphi*\fR, \fIlambda*\fR, and \fIzeta*\fR, with the north
pole lying on the \fIX\fR axis, signified by \fB\-GX\fR.
.IP 6. 4
Parametric coordinates, \fIphi*\*(Aq\fR, \fIlambda*\*(Aq\fR, and \fIzeta*\fR, with the
north pole lying on the \fIX\fR axis, signified by \fB\-PX\fR.
.IP 7. 4
Geocentric coordinates, \fIphi*"\fR, \fIlambda*"\fR, and \fIzeta*\fR, with the
north pole lying on the \fIX\fR axis, signified by \fB\-CX\fR.
.PP
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. \fIzeta\fR is the same for
the geodetic, parametric, and geocentric coordinate systems.
.PP
Points away from the surface of the ellipsoid can be described by the
orthogonal height \fIh\fR above from the ellipsoid and the position is
given by \fIphi\fR, \fIlambda\fR (giving the closest point on the ellipsoid),
and \fIh\fR. Alternatively, the confocal ellipsoid of minor radius \fIc\fR +
\&\fIH\fR point can be found and the position of the point is then given by
\&\fIbeta\fR, \fIomega\fR for the confocal ellipsoid and \fIH\fR.
.PP
By default, coordinates are provided on standard input as a set of lines
containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal
degrees or degrees, minutes and seconds). The interpretion of the
coordinates is governed by the \fB\-E\fR, \fB\-G\fR, \fB\-P\fR, \fB\-C\fR \fB\-GX\fR,
\&\fB\-PX\fR, and \fB\-CX\fR flags. For each set of coordinates, the
corresponding Cartesian coordinates \fIX\fR, \fIY\fR, \fIZ\fR (meters) are
printed on standard output. If \fI\-r\fR is provided, the reserve operation
is undertaken reading \fIX\fR, \fIY\fR, \fIZ\fR (which asre assumed to denote a
point on the ellipsoid) on standard input and printing the \fIlatitude\fR
and \fIlongitude\fR.
.PP
If the \fB\-3\fR flag is given (this cannot be combined with \fB\-D\fR), an
arbitrary point in three\-dimensional space is specified either with
\&\fIbeta\fR \fIomega\fR \fIH\fR or with \fIphi\fR \fIlambda\fR \fIh\fR.
.PP
If the \fB\-D\fR flag is given (this cannot be combined with \fB\-3\fR), the
heading (direction) is included in the computation converting \fIbeta\fR
\&\fIomega\fR \fIalpha\fR or \fIphi\fR \fIlambda\fR \fIzeta\fR to \fIX\fR, \fIY\fR, \fIZ\fR \fIVx\fR,
\&\fIVy\fR, \fIVz\fR where [\fIvx\fR, \fIvy\fR, \fIvz\fR] is a unit vector lying in the
surface of the ellipsoid.
.PP
If the \fB\-R\fR flag is given, do not read any input; instead output random
Cartesian points lying on the surface of the ellipsoid. If the \fB\-r\fR
flag is specified the Cartesian points are converted into one of the
triaxial coordinate systems.
.SH OPTIONS
.IX Header "OPTIONS"
.IP \fB\-E\fR 4
.IX Item "-E"
\&\fIlatitude\fR and \fIlongitude\fR is interpreted as ellipsoidal coordinates
\&\fIbeta\fR and \fIomega\fR. This is the default.
.IP "\fB\-G\fR or \fB\-GX\fR" 4
.IX Item "-G or -GX"
\&\fIlatitude\fR and \fIlongitude\fR is interpreted as geodetic coordinates
\&\fIphi\fR and \fIlambda\fR. The \fBX\fR added to the flags means that the north
pole lies on the \fIX\fR axis.
.IP "\fB\-P\fR or \fB\-PX\fR" 4
.IX Item "-P or -PX"
\&\fIlatitude\fR and \fIlongitude\fR is interpreted as parametric coordinates
\&\fIphi\*(Aq\fR and \fIlambda\*(Aq\fR. The \fBX\fR added to the flags means that the north
pole lies on the \fIX\fR axis.
.IP "\fB\-C\fR or \fB\-CX\fR" 4
.IX Item "-C or -CX"
\&\fIlatitude\fR and \fIlongitude\fR is interpreted as geocentric coordinates
\&\fIphi"\fR and \fIlambda"\fR. The \fBX\fR added to the flags means that the north
pole lies on the \fIX\fR axis.
.IP \fB\-r\fR 4
.IX Item "-r"
perform the reverse projection from \fIx\fR, \fIy\fR, \fIz\fR to \fIlatitude\fR,
\&\fIlongitude\fR. Unless \fB\-3\fR is given, it is assumed that the point lies
on the surface of the ellipsoid.
.IP \fB\-3\fR 4
.IX Item "-3"
include the height \fIh\fR or \fIH\fR in the calculation. This cannot be
combined with \fB\-D\fR.
.IP \fB\-D\fR 4
.IX Item "-D"
include the direction \fIalpha\fR or \fIzeta\fR in the calculation. With the
\&\fB\-r\fR option, it is assumed that the vector [\fIvx\fR, \fIvy\fR, \fIvz\fR] is
tangent to the surface of the ellipsoid. This cannot be combined with
\&\fB\-3\fR.
.IP "\fB\-R\fR \fInrand\fR" 4
.IX Item "-R nrand"
output \fInrand\fR random points on the surface of the ellipsoid as
Cartesian coordinates. With \fB\-D\fR add also a random Cartesian direction
tangent to the surface of the ellipsoid. In this mode, nothing is read
from standard input. With the \fB\-r\fR option the random points are
converted into one of the triaxial coordinate systems (and the direction
is converted to a heading if \fB\-D\fR is given).
.IP "\fB\-\-seed\fR \fIs\fR" 4
.IX Item "--seed s"
set the random number seed to \fIs\fR when using \fB\-R\fR. \fIs\fR = 0 (the
default) causes a random seed to be used.
.IP "\fB\-t\fR \fIa\fR \fIb\fR \fIc\fR" 4
.IX Item "-t a b c"
specify the ellipsoid via its major semiaxis \fIa\fR, median semiaxis \fIb\fR,
and minor semixis \fIc\fR. By default, we have \fIa\fR = 6378172 m, \fIb\fR =
6378102 m, \fIc\fR = 6356752 m, an approximate triaxial model of the earth.
(With this model \fIomg\fR = 0deg, corresponds to \fIlon\fR = \-14.93deg.
.IP "\fB\-e\fR \fIb\fR \fIe2\fR \fIk2\fR \fIkp2\fR" 4
.IX Item "-e b e2 k2 kp2"
specify the ellipsoid via the median semiaxis, \fIb\fR and the sphape
parameters \fIe2\fR = (\fIa\fR^2 \- \fIc\fR^2)/\fIb\fR^2, \fIk2\fR = (\fIb\fR^2 \-
\&\fIc\fR^2)/(\fIa\fR^2 \- \fIc\fR^2), and \fIkp2\fR = (\fIa\fR^2 \- \fIb\fR^2)/(\fIa\fR^2 \-
\&\fIc\fR^2). Simple fractions are allowed for \fIe2\fR, \fIk2\fR, and \fIkp2\fR.
Internally, the supplied values of \fIk2\fR and \fIkp2\fR are normalized so
that \fIk2\fR + \fIkp2\fR = 1.
.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\-p\fR \fIprec\fR" 4
.IX Item "-p prec"
set the output precision to \fIprec\fR (default 3). For distances, \fIprec\fR
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 \fIprec\fR + 5. For Cartesian directions, the precision is
\&\fIprec\fR + 7.
.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 EXAMPLES
.IX Header "EXAMPLES"
.Vb 4
\& echo 1 2 3 | Cart3Convert \-t 3 2 1 \-3 \-p 0 \-r
\& => 58.69140 75.11263 2.5860649
\& echo 58.69140 75.11263 2.5860649 | Cart3Convert \-t 3 2 1 \-3 \-p 0
\& => 1.0000001 2.0000003 2.9999999
.Ve
.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 \fBCart3Convert\fR to return an exit
code of 1. However, an error does not cause \fBCart3Convert\fR to
terminate; following lines will be converted.
.SH AUTHOR
.IX Header "AUTHOR"
\&\fBCart3Convert\fR was written by Charles Karney.
.SH HISTORY
.IX Header "HISTORY"
\&\fBCart3Convert\fR was added to GeographicLib,
<https://geographiclib.sourceforge.io>, in version 2.6.
|