1CS2CS(1) PROJ CS2CS(1)
2
3
4
6 cs2cs - Cartographic coordinate system filter
7
9 cs2cs [-eEfIlrstvwW [args]] [+opt[=arg] ...] [+to +opt[=arg] ...]
10 file ...
11
12 or
13 cs2cs [-eEfIlrstvwW [args]] {source_crs} +to {target_crs} file ...
14
15 where {source_crs} or {target_crs} is a PROJ string, a WKT string or
16 a AUTHORITY:CODE (where AUTHORITY is the name of a CRS authority and
17 CODE the code of a CRS found in the proj.db database), expressing a
18 coordinate reference system.
19
20 New in version 6.0.0.
21
22
23 or
24 cs2cs [-eEfIlrstvwW [args]] {source_crs} {target_crs}
25
26 New in version 6.0.0.
27
28
30 cs2cs performs transformation between the source and destination carto‐
31 graphic coordinate reference system on a set of input points. The coor‐
32 dinate reference system transformation can include translation between
33 projected and geographic coordinates as well as the application of
34 datum shifts.
35
36 The following control parameters can appear in any order:
37
38 -I Method to specify inverse translation, convert from +to coordi‐
39 nate system to the primary coordinate system defined.
40
41 -t<a> Where a specifies a character employed as the first character to
42 denote a control line to be passed through without processing.
43 This option applicable to ASCII input only. (# is the default
44 value).
45
46 -d <n>
47
48 New in version 5.2.0: Specify the number of decimals in the output.
49
50
51 -e <string>
52 Where string is an arbitrary string to be output if an error is
53 detected during data transformations. The default value is a
54 three character string: *\t*.
55
56 -E Causes the input coordinates to be copied to the output line
57 prior to printing the converted values.
58
59 -l<[=id]>
60 List projection identifiers that can be selected with +proj.
61 cs2cs -l=id gives expanded description of projection id, e.g.
62 cs2cs -l=merc.
63
64 -lp List of all projection id that can be used with the +proj param‐
65 eter. Equivalent to cs2cs -l.
66
67 -lP Expanded description of all projections that can be used with
68 the +proj parameter.
69
70 -le List of all ellipsoids that can be selected with the +ellps
71 parameters.
72
73 -lu List of all distance units that can be selected with the +units
74 parameter.
75
76 -ld List of datums that can be selected with the +datum parameter.
77
78 -r This options reverses the order of the first two expected inputs
79 from that specified by the CRS to the opposite order. The third
80 coordinate, typically height, remains third.
81
82 -s This options reverses the order of the first two expected out‐
83 puts from that specified by the CRS to the opposite order. The
84 third coordinate, typically height, remains third.
85
86 -f <format>
87 Where format is a printf format string to control the form of
88 the output values. For inverse projections, the output will be
89 in degrees when this option is employed. If a format is speci‐
90 fied for inverse projection the output data will be in decimal
91 degrees. The default format is "%.2f" for forward projection and
92 DMS for inverse.
93
94 -w<n> Where n is the number of significant fractional digits to employ
95 for seconds output (when the option is not specified, -w3 is
96 assumed).
97
98 -W<n> Where n is the number of significant fractional digits to employ
99 for seconds output. When -W is employed the fields will be con‐
100 stant width with leading zeroes.
101
102 -v Causes a listing of cartographic control parameters tested for
103 and used by the program to be printed prior to input data.
104
105 The +opt run-line arguments are associated with cartographic parame‐
106 ters.
107
108 The cs2cs program requires two coordinate reference system (CRS) defi‐
109 nitions. The first (or primary is defined based on all projection
110 parameters not appearing after the +to argument. All projection parame‐
111 ters appearing after the +to argument are considered the definition of
112 the second CRS. If there is no second CRS defined, a geographic CRS
113 based on the datum and ellipsoid of the source CRS is assumed. Note
114 that the source and destination CRS can both of same or different
115 nature (geographic, projected, compound CRS), or one of each and may
116 have the same or different datums.
117
118 When using a WKT definition or a AUTHORITY:CODE, the axis order of the
119 CRS will be enforced. So for example if using EPSG:4326, the first
120 value expected (or returned) will be a latitude.
121
122 Internally, cs2cs uses the proj_create_crs_to_crs() function to compute
123 the appropriate coordinate operation, so implementation details of this
124 function directly impact the results returned by the program.
125
126 The environment parameter PROJ_LIB establishes the directory for
127 resource files (database, datum shift grids, etc.)
128
129 One or more files (processed in left to right order) specify the source
130 of data to be transformed. A - will specify the location of processing
131 standard input. If no files are specified, the input is assumed to be
132 from stdin. For input data the two data values must be in the first
133 two white space separated fields and when both input and output are
134 ASCII all trailing portions of the input line are appended to the out‐
135 put line.
136
137 Input geographic data (longitude and latitude) must be in DMS or deci‐
138 mal degrees format and input cartesian data must be in units consistent
139 with the ellipsoid major axis or sphere radius units. Output geographic
140 coordinates will normally be in DMS format (use -f %.12f for decimal
141 degrees with 12 decimal places), while projected (cartesian) coordi‐
142 nates will be in linear (meter, feet) units.
143
145 Using PROJ strings
146 The following script
147
148 cs2cs +proj=latlong +datum=NAD83 +to +proj=utm +zone=10 +datum=NAD27 -r <<EOF
149 45d15'33.1" 111.5W
150 45d15.551666667N -111d30
151 +45.25919444444 111d30'000w
152 EOF
153
154 will transform the input NAD83 geographic coordinates into NAD27 coor‐
155 dinates in the UTM projection with zone 10 selected. The geographic
156 values of this example are equivalent and meant as examples of various
157 forms of DMS input. The x-y output data will appear as three lines of:
158
159 1402293.44 5076292.68 0.00
160
161 Using EPSG codes
162 Transforming from WGS 84 latitude/longitude (in that order) to UTM Zone
163 31N/WGS 84
164
165 cs2cs EPSG:4326 EPSG:32631 <<EOF
166 45N 2E
167 EOF
168
169 outputs
170
171 421184.70 4983436.77 0.00
172
174 proj(1), cct(1), geod(1), gie(1), projinfo(1)
175
177 A list of know bugs can be found at
178 https://github.com/OSGeo/PROJ/issues where new bug reports can be sub‐
179 mitted to.
180
182 https://proj.org/
183
185 Frank Warmerdam
186
188 1983-2020
189
190
191
192
1936.3.2 Apr 27, 2020 CS2CS(1)