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} {target_crs} file ...
14
15 where {source_crs} or {target_crs} is one of the possibilities ac‐
16 cepted by proj_create(), provided it expresses a CRS
17
18 • a proj-string,
19
20 • a WKT string,
21
22 • an object code (like "EPSG:4326", "urn:ogc:def:crs:EPSG::4326",
23 "urn:ogc:def:coordinateOperation:EPSG::1671"),
24
25 • an Object name. e.g "WGS 84", "WGS 84 / UTM zone 31N". In that
26 case as uniqueness is not guaranteed, heuristics are applied to
27 determine the appropriate best match.
28
29 • a OGC URN combining references for compound coordinate reference
30 systems (e.g "urn:ogc:def:crs,crs:EPSG::2393,crs:EPSG::5717" or
31 custom abbreviated syntax "EPSG:2393+5717"),
32
33 • a OGC URN combining references for references for projected or de‐
34 rived CRSs e.g. for Projected 3D CRS "UTM zone 31N / WGS 84 (3D)":
35 "‐
36 urn:ogc:def:crs,crs:EPSG::4979,cs:PROJ::ENh,coordinateOpera‐
37 tion:EPSG::16031" (added in 6.2)
38
39 • a OGC URN combining references for concatenated operations (e.g.
40 "‐
41 urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,co‐
42 ordinateOperation:EPSG::1618")
43
44 • a PROJJSON string. The jsonschema is at
45 https://proj.org/schemas/v0.2/projjson.schema.json (added in 6.2)
46
47 • a compound CRS made from two object names separated with " + ".
48 e.g. "WGS 84 + EGM96 height" (added in 7.1)
49
50 New in version 6.0.0.
51
52
53 NOTE:
54 before 7.0.1, it was needed to add +to between {source_crs} and
55 {target_crs} when adding a filename
56
58 cs2cs performs transformation between the source and destination carto‐
59 graphic coordinate reference system on a set of input points. The coor‐
60 dinate reference system transformation can include translation between
61 projected and geographic coordinates as well as the application of da‐
62 tum shifts.
63
64 The following control parameters can appear in any order:
65
66 -I Method to specify inverse translation, convert from +to coordi‐
67 nate system to the primary coordinate system defined.
68
69 -t<a> Where a specifies a character employed as the first character to
70 denote a control line to be passed through without processing.
71 This option applicable to ASCII input only. (# is the default
72 value).
73
74 -d <n> New in version 5.2.0.
75
76
77 Specify the number of decimals in the output.
78
79 -e <string>
80 Where string is an arbitrary string to be output if an error is
81 detected during data transformations. The default value is a
82 three character string: *\t*.
83
84 -E Causes the input coordinates to be copied to the output line
85 prior to printing the converted values.
86
87 -l<[=id]>
88 List projection identifiers that can be selected with +proj.
89 cs2cs -l=id gives expanded description of projection id, e.g.
90 cs2cs -l=merc.
91
92 -lp List of all projection id that can be used with the +proj param‐
93 eter. Equivalent to cs2cs -l.
94
95 -lP Expanded description of all projections that can be used with
96 the +proj parameter.
97
98 -le List of all ellipsoids that can be selected with the +ellps pa‐
99 rameters.
100
101 -lu List of all distance units that can be selected with the +units
102 parameter.
103
104 -r This options reverses the order of the first two expected inputs
105 from that specified by the CRS to the opposite order. The third
106 coordinate, typically height, remains third.
107
108 -s This options reverses the order of the first two expected out‐
109 puts from that specified by the CRS to the opposite order. The
110 third coordinate, typically height, remains third.
111
112 -f <format>
113 Where format is a printf format string to control the form of
114 the output values. For inverse projections, the output will be
115 in degrees when this option is employed. If a format is speci‐
116 fied for inverse projection the output data will be in decimal
117 degrees. The default format is "%.2f" for forward projection and
118 DMS for inverse.
119
120 -w<n> Where n is the number of significant fractional digits to employ
121 for seconds output (when the option is not specified, -w3 is as‐
122 sumed).
123
124 -W<n> Where n is the number of significant fractional digits to employ
125 for seconds output. When -W is employed the fields will be con‐
126 stant width with leading zeroes.
127
128 -v Causes a listing of cartographic control parameters tested for
129 and used by the program to be printed prior to input data.
130
131 The +opt run-line arguments are associated with cartographic parame‐
132 ters.
133
134 The cs2cs program requires two coordinate reference system (CRS) defi‐
135 nitions. The first (or primary is defined based on all projection pa‐
136 rameters not appearing after the +to argument. All projection parame‐
137 ters appearing after the +to argument are considered the definition of
138 the second CRS. If there is no second CRS defined, a geographic CRS
139 based on the datum and ellipsoid of the source CRS is assumed. Note
140 that the source and destination CRS can both of same or different na‐
141 ture (geographic, projected, compound CRS), or one of each and may have
142 the same or different datums.
143
144 When using a WKT definition or a AUTHORITY:CODE, the axis order of the
145 CRS will be enforced. So for example if using EPSG:4326, the first
146 value expected (or returned) will be a latitude.
147
148 Internally, cs2cs uses the proj_create_crs_to_crs() function to compute
149 the appropriate coordinate operation, so implementation details of this
150 function directly impact the results returned by the program.
151
152 The environment parameter PROJ_LIB establishes the directory for re‐
153 source files (database, datum shift grids, etc.)
154
155 One or more files (processed in left to right order) specify the source
156 of data to be transformed. A - will specify the location of processing
157 standard input. If no files are specified, the input is assumed to be
158 from stdin. For input data the two data values must be in the first
159 two white space separated fields and when both input and output are
160 ASCII all trailing portions of the input line are appended to the out‐
161 put line.
162
163 Input geographic data (longitude and latitude) must be in DMS or deci‐
164 mal degrees format and input cartesian data must be in units consistent
165 with the ellipsoid major axis or sphere radius units. Output geographic
166 coordinates will normally be in DMS format (use -f %.12f for decimal
167 degrees with 12 decimal places), while projected (cartesian) coordi‐
168 nates will be in linear (meter, feet) units.
169
170 Use of remote grids
171 New in version 7.0.0.
172
173
174 If the PROJ_NETWORK environment variable is set to ON, cs2cs will at‐
175 tempt to use remote grids stored on CDN (Content Delivery Network)
176 storage, when they are not available locally.
177
178 More details are available in the network section.
179
181 Using PROJ strings
182 The following script
183
184 cs2cs +proj=latlong +datum=NAD83 +to +proj=utm +zone=10 +datum=NAD27 -r <<EOF
185 45d15'33.1" 111.5W
186 45d15.551666667N -111d30
187 +45.25919444444 111d30'000w
188 EOF
189
190 will transform the input NAD83 geographic coordinates into NAD27 coor‐
191 dinates in the UTM projection with zone 10 selected. The geographic
192 values of this example are equivalent and meant as examples of various
193 forms of DMS input. The x-y output data will appear as three lines of:
194
195 1402293.44 5076292.68 0.00
196
197 Using EPSG CRS codes
198 Transforming from WGS 84 latitude/longitude (in that order) to UTM Zone
199 31N/WGS 84
200
201 cs2cs EPSG:4326 EPSG:32631 <<EOF
202 45N 2E
203 EOF
204
205 outputs
206
207 421184.70 4983436.77 0.00
208
209 Using EPSG CRS names
210 Transforming from WGS 84 latitude/longitude (in that order) with EGM96
211 height to UTM Zone 31N/WGS 84 with WGS84 ellipsoidal height
212
213 echo 45 2 0 | cs2cs "WGS 84 + EGM96 height" "WGS 84 / UTM zone 31N"
214
215 outputs
216
217 421184.70 4983436.77 50.69
218
220 proj(1), cct(1), geod(1), gie(1), projinfo(1), projsync(1)
221
223 A list of know bugs can be found at
224 https://github.com/OSGeo/PROJ/issues where new bug reports can be sub‐
225 mitted to.
226
228 https://proj.org/
229
231 Frank Warmerdam
232
234 1983-2020
235
236
237
238
2397.2.1 Dec 25, 2020 CS2CS(1)