1CARTCONVERT(1) GeographicLib Utilities CARTCONVERT(1)
2
3
4
6 CartConvert -- convert geodetic coordinates to geocentric or local
7 cartesian
8
10 CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ -w ] [ -p prec ] [
11 --comment-delimiter commentdelim ] [ --version | -h | --help ] [
12 --input-file infile | --input-string instring ] [ --line-separator
13 linesep ] [ --output-file outfile ]
14
16 Convert geodetic coordinates to either geocentric or local cartesian
17 coordinates. Geocentric coordinates have the origin at the center of
18 the earth, with the z axis going thru the north pole, and the x axis
19 thru latitude = 0, longitude = 0. By default, the conversion is to
20 geocentric coordinates. Specifying -l lat0 lon0 h0 causes a local
21 coordinate system to be used with the origin at latitude = lat0,
22 longitude = lon0, height = h0, z normal to the ellipsoid and y due
23 north.
24
25 Geodetic coordinates are provided on standard input as a set of lines
26 containing (blank separated) latitude, longitude (decimal degrees or
27 degrees, minutes and seconds), and height above the ellipsoid (meters);
28 for details on the allowed formats for latitude and longitude, see the
29 "GEOGRAPHIC COORDINATES" section of GeoConvert(1). For each set of
30 geodetic coordinates, the corresponding cartesian coordinates x, y, z
31 (meters) are printed on standard output.
32
34 -r perform the reverse projection. x, y, z are given on standard
35 input and each line of standard output gives latitude, longitude,
36 height.
37
38 -l lat0 lon0 h0
39 specifies conversions to and from a local cartesion coordinate
40 systems with origin lat0 lon0 h0, instead of a geocentric
41 coordinate system. The -w flag can be used to swap the default
42 order of the 2 geographic coordinates, provided that it appears
43 before -l.
44
45 -e a f
46 specify the ellipsoid via the equatorial radius, a and the
47 flattening, f. Setting f = 0 results in a sphere. Specify f < 0
48 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is
49 allowed for f. By default, the WGS84 ellipsoid is used, a =
50 6378137 m, f = 1/298.257223563.
51
52 -w toggle the longitude first flag (it starts off); if the flag is on,
53 then on input and output, longitude precedes latitude (except that,
54 on input, this can be overridden by a hemisphere designator, N, S,
55 E, W).
56
57 -p prec
58 set the output precision to prec (default 6). prec is the number
59 of digits after the decimal point for geocentric and local
60 cartesion coordinates and for the height (in meters). For
61 latitudes and longitudes (in degrees), the number of digits after
62 the decimal point is prec + 5.
63
64 --comment-delimiter commentdelim
65 set the comment delimiter to commentdelim (e.g., "#" or "//"). If
66 set, the input lines will be scanned for this delimiter and, if
67 found, the delimiter and the rest of the line will be removed prior
68 to processing and subsequently appended to the output line
69 (separated by a space).
70
71 --version
72 print version and exit.
73
74 -h print usage and exit.
75
76 --help
77 print full documentation and exit.
78
79 --input-file infile
80 read input from the file infile instead of from standard input; a
81 file name of "-" stands for standard input.
82
83 --input-string instring
84 read input from the string instring instead of from standard input.
85 All occurrences of the line separator character (default is a
86 semicolon) in instring are converted to newlines before the reading
87 begins.
88
89 --line-separator linesep
90 set the line separator character to linesep. By default this is a
91 semicolon.
92
93 --output-file outfile
94 write output to the file outfile instead of to standard output; a
95 file name of "-" stands for standard output.
96
98 echo 33.3 44.4 6000 | CartConvert
99 => 3816209.60 3737108.55 3485109.57
100 echo 33.3 44.4 6000 | CartConvert -l 33 44 20
101 => 37288.97 33374.29 5783.64
102 echo 30000 30000 0 | CartConvert -r
103 => 6.483 45 -6335709.73
104
106 An illegal line of input will print an error message to standard output
107 beginning with "ERROR:" and causes CartConvert to return an exit code
108 of 1. However, an error does not cause CartConvert to terminate;
109 following lines will be converted.
110
112 The algorithm for converting geocentric to geodetic coordinates is
113 given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of
114 revolution, Feb. 2011; preprint <https://arxiv.org/abs/1102.1215>.
115
117 CartConvert was written by Charles Karney.
118
120 CartConvert was added to GeographicLib,
121 <https://geographiclib.sourceforge.io>, in 2009-02. Prior to 2009-03
122 it was called ECEFConvert.
123
124
125
126GeographicLib 1.49 2017-10-05 CARTCONVERT(1)