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. In general there are multiple solutions and the result
37 which minimizes the absolute value of height is returned, i.e.,
38 (latitude, longitude) corresponds to the closest point on the
39 ellipsoid.
40
41 -l lat0 lon0 h0
42 specifies conversions to and from a local cartesion coordinate
43 systems with origin lat0 lon0 h0, instead of a geocentric
44 coordinate system. The -w flag can be used to swap the default
45 order of the 2 geographic coordinates, provided that it appears
46 before -l.
47
48 -e a f
49 specify the ellipsoid via the equatorial radius, a and the
50 flattening, f. Setting f = 0 results in a sphere. Specify f < 0
51 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is
52 allowed for f. By default, the WGS84 ellipsoid is used, a =
53 6378137 m, f = 1/298.257223563.
54
55 -w toggle the longitude first flag (it starts off); if the flag is on,
56 then on input and output, longitude precedes latitude (except that,
57 on input, this can be overridden by a hemisphere designator, N, S,
58 E, W).
59
60 -p prec
61 set the output precision to prec (default 6). prec is the number
62 of digits after the decimal point for geocentric and local
63 cartesion coordinates and for the height (in meters). For
64 latitudes and longitudes (in degrees), the number of digits after
65 the decimal point is prec + 5.
66
67 --comment-delimiter commentdelim
68 set the comment delimiter to commentdelim (e.g., "#" or "//"). If
69 set, the input lines will be scanned for this delimiter and, if
70 found, the delimiter and the rest of the line will be removed prior
71 to processing and subsequently appended to the output line
72 (separated by a space).
73
74 --version
75 print version and exit.
76
77 -h print usage and exit.
78
79 --help
80 print full documentation and exit.
81
82 --input-file infile
83 read input from the file infile instead of from standard input; a
84 file name of "-" stands for standard input.
85
86 --input-string instring
87 read input from the string instring instead of from standard input.
88 All occurrences of the line separator character (default is a
89 semicolon) in instring are converted to newlines before the reading
90 begins.
91
92 --line-separator linesep
93 set the line separator character to linesep. By default this is a
94 semicolon.
95
96 --output-file outfile
97 write output to the file outfile instead of to standard output; a
98 file name of "-" stands for standard output.
99
101 echo 33.3 44.4 6000 | CartConvert
102 => 3816209.60 3737108.55 3485109.57
103 echo 33.3 44.4 6000 | CartConvert -l 33 44 20
104 => 37288.97 33374.29 5783.64
105 echo 30000 30000 0 | CartConvert -r
106 => 6.483 45 -6335709.73
107
109 An illegal line of input will print an error message to standard output
110 beginning with "ERROR:" and causes CartConvert to return an exit code
111 of 1. However, an error does not cause CartConvert to terminate;
112 following lines will be converted.
113
115 The algorithm for converting geocentric to geodetic coordinates is
116 given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of
117 revolution, Feb. 2011; preprint <https://arxiv.org/abs/1102.1215>.
118
120 CartConvert was written by Charles Karney.
121
123 CartConvert was added to GeographicLib,
124 <https://geographiclib.sourceforge.io>, in 2009-02. Prior to 2009-03
125 it was called ECEFConvert.
126
127
128
129GeographicLib 1.52 2021-06-21 CARTCONVERT(1)