Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

mapproject.rst 17 KB

You have to be logged in to leave a comment. Sign In
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
  1. .. index:: ! mapproject
  2. .. include:: module_core_purpose.rst_
  3. **********
  4. mapproject
  5. **********
  6. |mapproject_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt mapproject** [ *tables* ] |-J|\ *parameters*
  11. |SYN_OPT-R|
  12. [ |-A|\ **b**\|\ **B**\|\ **f**\|\ **F**\|\ **o**\|\ **O**\ [*lon0*/*lat0*][**+v**] ]
  13. [ |-C|\ [*dx*/*dy*] ]
  14. [ |-D|\ **c**\|\ **i**\|\ **p** ]
  15. [ |-E|\ [*datum*] ] [ |-F|\ [*unit*] ]
  16. [ |-G|\ [*lon0*/*lat0*][**+a**][**+i**][**+u**\ *unit*][**+v**] ]
  17. [ |-I| ]
  18. [ |-L|\ *line.xy*\ [**+u**\ *unit*][**+p**] ]
  19. [ |-N|\ [**a**\|\ **c**\|\ **g**\|\ **m**] ]
  20. [ |-Q|\ [**d**\|\ **e**] ]
  21. [ |-S| ]
  22. [ |-T|\ [**h**]\ *from*\ [/*to*] ]
  23. [ |SYN_OPT-V| ]
  24. [ |-W|\ [**g**\|\ **h**\|\ **j**\|\ **n**\|\ **w**\|\ **x**] ]
  25. [ |-Z|\ [*speed*][**+a**][**+i**][**+f**][**+t**\ *epoch*] ]
  26. [ |SYN_OPT-b| ]
  27. [ |SYN_OPT-d| ]
  28. [ |SYN_OPT-e| ]
  29. [ |SYN_OPT-f| ]
  30. [ |SYN_OPT-g| ]
  31. [ |SYN_OPT-h| ]
  32. [ |SYN_OPT-i| ]
  33. [ |SYN_OPT-j| ]
  34. [ |SYN_OPT-o| ]
  35. [ |SYN_OPT-p| ]
  36. [ |SYN_OPT-q| ]
  37. [ |SYN_OPT-s| ]
  38. [ |SYN_OPT-:| ]
  39. [ |SYN_OPT--| ]
  40. |No-spaces|
  41. Description
  42. -----------
  43. **mapproject** reads (longitude, latitude) positions from *tables* [or
  44. standard input] and computes (x,y) coordinates using the specified map
  45. projection and scales. Optionally, it can read (x,y) positions and
  46. compute (longitude, latitude) values doing the inverse transformation.
  47. This can be used to transform linear (x,y) points obtained by digitizing
  48. a map of known projection to geographical coordinates. May also
  49. calculate distances along track, to a fixed point, or closest approach
  50. to a line.
  51. Alternatively, can be used to perform various datum conversions.
  52. Additional data fields are permitted after the first 2 columns which
  53. must have (longitude,latitude) or (x,y). See option **-:** on how to
  54. read (latitude,longitude) files.
  55. Finally, **mapproject** can compute a variety of auxiliary output
  56. data from input coordinates that make up a track. Items like
  57. azimuth, distances, distances to other lines, and travel-times
  58. along lines can all be computed by using one or more of the options
  59. **-A**, **-G**, **-L**, and **-Z**.
  60. Required Arguments
  61. ------------------
  62. .. _-J:
  63. .. |Add_-J| unicode:: 0x20 .. just an invisible code
  64. .. include:: explain_-J.rst_
  65. .. _-R:
  66. .. |Add_-R| replace:: Special case for the UTM
  67. projection: If **-C** is used and **-R** is not given then the
  68. region is set to coincide with the given UTM zone so as to preserve
  69. the full ellipsoidal solution (See RESTRICTIONS for more information).
  70. .. include:: explain_-R.rst_
  71. Optional Arguments
  72. ------------------
  73. .. |Add_intables| unicode:: 0x20 .. just an invisible code
  74. .. include:: explain_intables.rst_
  75. .. _-A:
  76. **-Ab**\|\ **B**\|\ **f**\|\ **F**\|\ **o**\|\ **O**\ [*lon0*/*lat0*][**+v**]
  77. Calculate azimuth along track *or* to the optional *fixed* point set
  78. with *lon0/lat0*. **-Af** calculates the (forward) azimuth
  79. to each data point. Use **-Ab** to get back-azimuth from data points
  80. to fixed point. Use **-Ao** to get orientations (-90/90) rather than
  81. azimuths (0/360). Upper case **F**, **B** or **O** will convert from
  82. geodetic to geocentric latitudes and estimate azimuth of geodesics
  83. (assuming the current ellipsoid is not a sphere). If no fixed point
  84. is given then we compute the azimuth (or back-azimuth) from the
  85. previous point. Alternatively, append **+v** to obtain a
  86. *variable* 2nd point (*lon0*/*lat0*) via columns 3-4 in the input file.
  87. See `Output Order`_ for how **-A** affects the output record.
  88. .. _-C:
  89. **-C**\ [*dx*/*dy*]
  90. Set center of projected coordinates to be at map projection center
  91. [Default is lower left corner]. Optionally, add offsets in the
  92. projected units to be added (or subtracted when **-I** is set) to
  93. (from) the projected coordinates, such as false eastings and
  94. northings for particular projection zones [0/0]. The unit used for
  95. the offsets is the plot distance unit in effect (see
  96. :term:`PROJ_LENGTH_UNIT`) unless **-F** is used, in which case the
  97. offsets are in meters.
  98. .. _-D:
  99. **-Dc**\|\ **i**\|\ **p**
  100. Temporarily override :term:`PROJ_LENGTH_UNIT` and use **c** (cm),
  101. **i** (inch), or **p** (points) instead. Cannot be used with **-F**.
  102. .. _-E:
  103. **-E**\ [*datum*]
  104. Convert from geodetic (lon, lat, height) to Earth Centered Earth Fixed (ECEF) (x,y,z) coordinates
  105. (add **-I** for the inverse conversion). Append datum ID (see **-Qd**) or give
  106. *ellipsoid*:*dx*,\ *dy*,\ *dz* where *ellipsoid* may be an ellipsoid
  107. ID (see **-Qe**) or given as *a*\ [,\ *inv_f*], where *a* is the
  108. semi-major axis and *inv_f* is the inverse flattening (0 if
  109. omitted). If *datum* is - or not given we assume WGS-84.
  110. .. _-F:
  111. **-F**\ [*unit*]
  112. Force 1:1 scaling, i.e., output (or input, see **-I**) data are in
  113. actual projected meters. To specify other units, append the desired
  114. unit (see `Units`_). Without **-F**, the output (or input, see **-I**)
  115. are in the units specified by :term:`PROJ_LENGTH_UNIT` (but see
  116. **-D**).
  117. .. _-G:
  118. **-G**\ [*lon0*/*lat0*][**+a**][**+i**][**+u**\ *unit*][**+v**]
  119. Calculate distances along track *or* to the optional *fixed* point set
  120. with **-G**\ *lon0*/*lat0*. Append the distance unit with **+u** (see `Units`_
  121. for available units and how distances are computed [great circle using authalic
  122. radius]), including **c** (Cartesian distance using input coordinates) or **C**
  123. (Cartesian distance using projected coordinates). The **C** unit
  124. requires **-R** and **-J** to be set. If no fixed point is given
  125. we calculate *accumulated* distances whereas if a fixed point is given
  126. we calculate *incremental* distances. You can override these defaults
  127. by adding **+a** for accumulated or **+i** for incremental distances.
  128. If both **+a** and **+i** are given we will report both types of distances.
  129. Append **+v** to obtain a *variable* 2nd point (*lon0*/*lat0*) via columns
  130. 3-4 in the input file; this updates the fixed point per record and thus the
  131. selection defaults to incremental distances.
  132. See `Output Order`_ for how **-G** affects the output record.
  133. .. _-I:
  134. **-I**
  135. Do the Inverse transformation, i.e., get (longitude,latitude) from (x,y) data.
  136. .. _-L:
  137. **-L**\ *line.xy*\ [**+u**\ *unit* \|\ *c* \|\ *C*][**+p**]
  138. Determine the shortest distance from the input data points to the
  139. line(s) given in the ASCII multisegment file *line.xy*. The distance
  140. and the coordinates of the nearest point will be appended to the
  141. output as three new columns. Append the distance unit via **+u** (see `Units`_
  142. for available units and how distances are computed [great circle using authalic radius]),
  143. including **c** (Cartesian distance using input coordinates) or
  144. **C** (Cartesian distance using projected coordinates). Note that these **c** and **C** are
  145. not listed in `Units`_ and would be used for example as **+uc**. The **C**
  146. unit requires **-R** and **-J** to be set. Finally, append **+p** to
  147. report the line segment id and the fractional point number instead
  148. of lon/lat of the nearest point.
  149. See `Output Order`_ for how **-L** affects the output record.
  150. .. _-N:
  151. **-N**\ [**a**\|\ **c**\|\ **g**\|\ **m**]
  152. Convert from geodetic latitudes (using the current ellipsoid; see
  153. :term:`PROJ_ELLIPSOID`) to one of four different auxiliary latitudes
  154. (longitudes are unaffected). Choose from **a**\ uthalic,
  155. **c**\ onformal, **g**\ eocentric, and **m**\ eridional latitudes
  156. [geocentric]. Use **-I** to convert from auxiliary latitudes to
  157. geodetic latitudes.
  158. .. _-Q:
  159. **-Q**\ [**d**\|\ **e**]
  160. List all projection parameters. To only list datums, use **-Qd**. To
  161. only list ellipsoids, use **-Qe**.
  162. .. _-S:
  163. **-S**
  164. Suppress points that fall outside the region.
  165. .. _-T:
  166. **-T**\ [**h**]\ *from*\ [/*to*]
  167. Coordinate conversions between datums *from* and *to* using the
  168. standard Molodensky transformation. Use **-Th** if 3rd input column
  169. has height above ellipsoid [Default assumes height = 0, i.e., on the
  170. ellipsoid]. Specify datums using the datum ID (see **-Qd**) or give
  171. *ellipsoid*:*dx*,\ *dy*,\ *dz* where *ellipsoid* may be an ellipsoid
  172. ID (see **-Qe**) or given as *a*\ [,\ *inv_f*], where *a* is the
  173. semi-major axis and *inv_f* is the inverse flattening (0 if
  174. omitted). If *datum* is - or not given we assume WGS-84. **-T** may
  175. be used in conjunction with **-R** **-J** to change the datum before
  176. coordinate projection (add **-I** to apply the datum conversion
  177. after the inverse projection). Make sure that the
  178. :term:`PROJ_ELLIPSOID` setting is correct for your case.
  179. .. _-V:
  180. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  181. .. include:: explain_-V.rst_
  182. .. _-W:
  183. **-W**\ [**g**\|\ **h**\|\ **j**\|\ **n**\|\ **w**\|\ **x**]
  184. Prints map width and height on standard output. No input files are read.
  185. To only output the width or the height, append **w** or **h**, respectively.
  186. To output the plot coordinates of a map point, give **g**\ *lon*/*lat*.
  187. The units of reported plot dimensions may be changed via **-D**.
  188. To output the map coordinates of a reference point, select **j**\ *code* (with
  189. standard two-character justification codes), **n**\ *rx*/*ry*, where the reference
  190. point is given as normalized positions in the 0-1 range, or **x**\ *px*/*py*,
  191. where a plot point is given directly [Default returns the width and height of the map].
  192. .. _-Z:
  193. **-Z**\ [*speed*][**+a**][**+i**][**+f**][**+t**\ *epoch*]
  194. Calculate travel times along track as specified with **-G**.
  195. Append a constant speed unit; if missing we expect to read
  196. a variable speed from column 3. The speed is expected to be
  197. in the distance units set via **-G** per time unit controlled
  198. by :term:`TIME_UNIT` [m/s]. Append **+i** to output
  199. *incremental* travel times between successive points, **+a**
  200. to obtain *accumulated* travel times, or both to get both kinds
  201. of time information. Use **+f** to format the accumulated
  202. (elapsed) travel time according to the ISO 8601 convention.
  203. As for the number of decimals used to represent seconds we
  204. consult the :term:`FORMAT_CLOCK_OUT`
  205. setting. Finally, append **+t**\ *epoch* to report absolute
  206. times (ETA) for successive points. Finally, because of the
  207. need for incremental distances the **-G** option with the
  208. **+i** modifier is required.
  209. See `Output Order`_ for how **-Z** affects the output record.
  210. .. |Add_-bi| replace:: [Default is 2 input columns].
  211. .. include:: explain_-bi.rst_
  212. .. |Add_-bo| replace:: [Default is same as input].
  213. .. include:: explain_-bo.rst_
  214. .. |Add_-d| unicode:: 0x20 .. just an invisible code
  215. .. include:: explain_-d.rst_
  216. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  217. .. include:: explain_-e.rst_
  218. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  219. .. include:: explain_-f.rst_
  220. .. |Add_-g| unicode:: 0x20 .. just an invisible code
  221. .. include:: explain_-g.rst_
  222. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  223. .. include:: explain_-h.rst_
  224. .. include:: explain_-icols.rst_
  225. .. include:: explain_distcalc.rst_
  226. .. include:: explain_-ocols.rst_
  227. .. |Add_perspective| unicode:: 0x20 .. just an invisible code
  228. .. include:: explain_perspective.rst_
  229. .. include:: explain_-q.rst_
  230. .. include:: explain_-s.rst_
  231. .. include:: explain_colon.rst_
  232. .. include:: explain_help.rst_
  233. .. include:: explain_distunits.rst_
  234. .. include:: explain_precision.rst_
  235. Examples
  236. --------
  237. .. include:: explain_example.rst_
  238. To transform a remote file with (latitude,longitude) into (x,y) positions in cm
  239. on a Mercator grid for a given scale of 0.5 cm per degree and selected region, run
  240. ::
  241. gmt mapproject @waypoints.txt -R-180/180/-72/72 -Jm0.5c -: > xyfile
  242. To convert UTM coordinates in meters to geographic locations, given
  243. a file utm.txt and knowing the UTM zone (and zone or hemisphere), try
  244. ::
  245. gmt mapproject utm.txt -Ju+11/1:1 -C -I -F
  246. To transform several 2-column, binary, double precision files with
  247. (latitude,longitude) into (x,y) positions in inch on a Transverse
  248. Mercator grid (central longitude 75W) for scale = 1:500000 and suppress
  249. those points that would fall outside the map area, run
  250. ::
  251. gmt mapproject tracks.* -R-80/-70/20/40 -Jt-75/1:500000 -: -S -Di -bo -bi2 > tmfile.b
  252. To convert the geodetic coordinates (lon, lat, height) in the file
  253. old.txt from the NAD27 CONUS datum (Datum ID 131 which uses the
  254. Clarke-1866 ellipsoid) to WGS 84, run
  255. ::
  256. gmt mapproject old.txt -Th131 > new.txt
  257. To compute the closest distance (in km) between each point in the input
  258. file quakes.txt and the line segments given in the multisegment ASCII
  259. file coastline.xy, run
  260. ::
  261. gmt mapproject quakes.txt -Lcoastline.xy+uk > quake_dist.txt
  262. Given a file with longitude and latitude, compute both incremental
  263. and accumulated distance along track, and estimate travel times
  264. assuming a fixed speed of 12 knots. We do this with
  265. ::
  266. gmt mapproject track.txt -G+un+a+i -Z12+a --TIME_UNIT=h > elapsed_time.txt
  267. where :term:`TIME_UNIT` is set to hour so that the speed is
  268. measured in nm (set by **-G**) per hour (set by :term:`TIME_UNIT`).
  269. Elapsed times will be reported in hours (unless **+f** is added to **-Z**
  270. for ISO elapsed time).
  271. To determine the geographic coordinates of the mid-point of this transverse Mercator map, try
  272. ::
  273. gmt mapproject -R-80/-70/20/40 -Jt-75/1:500000 -WjCM > mid_point.txt
  274. where :term:`TIME_UNIT` is set to hour so that the speed is
  275. Restrictions
  276. ------------
  277. The rectangular input region set with **-R** will in general be mapped
  278. into a non-rectangular grid. Unless **-C** is set, the leftmost point on
  279. this grid has xvalue = 0.0, and the lowermost point will have yvalue =
  280. 0.0. Thus, before you digitize a map, run the extreme map coordinates
  281. through **mapproject** using the appropriate scale and see what (x,y)
  282. values they are mapped onto. Use these values when setting up for
  283. digitizing in order to have the inverse transformation work correctly,
  284. or alternatively, use **awk** to scale and shift the (x,y) values before
  285. transforming.
  286. For some projection, a spherical solution may be used despite the user
  287. having selected an ellipsoid. This occurs when the users **-R** setting
  288. implies a region that exceeds the domain in which the ellipsoidal series
  289. expansions are valid. These are the conditions: (1) Lambert Conformal
  290. Conic (**-JL**)and Albers Equal-Area (**-JB**) will use the spherical
  291. solution when the map scale exceeds 1.0E7. (2) Transverse Mercator
  292. (**-JT**) and UTM (**-JU**) will will use the spherical solution when
  293. either the west or east boundary given in **-R** is more than 10 degrees
  294. from the central meridian, and (3) same for Cassini
  295. (**-JC**) but with a limit of only 4 degrees.
  296. Ellipsoids And Spheroids
  297. ------------------------
  298. GMT will use ellipsoidal formulae if they are implemented and the
  299. user have selected an ellipsoid as the reference shape (see
  300. :term:`PROJ_ELLIPSOID`). The user needs to be aware of a
  301. few potential pitfalls: (1) For some projections, such as Transverse
  302. Mercator, Albers, and Lambert's conformal conic we use the ellipsoidal
  303. expressions when the areas mapped are small, and switch to the spherical
  304. expressions (and substituting the appropriate auxiliary latitudes) for
  305. larger maps. The ellipsoidal formulae are used as follows: (a)
  306. Transverse Mercator: When all points are within 10 degrees of central
  307. meridian, (b) Conic projections when longitudinal range is less than 90
  308. degrees, (c) Cassini projection when all points are within 4 degrees of
  309. central meridian. (2) When you are trying to match some historical data
  310. (e.g., coordinates obtained with a certain projection and a certain
  311. reference ellipsoid) you may find that GMT gives results that are
  312. slightly different. One likely source of this mismatch is that older
  313. calculations often used less significant digits. For instance, Snyder's
  314. examples often use the Clarke 1866 ellipsoid (defined by him as having a
  315. flattening f = 1/294.98). From f we get the eccentricity squared to be
  316. 0.00676862818 (this is what GMT uses), while Snyder rounds off and
  317. uses 0.00676866. This difference can give discrepancies of several tens
  318. of cm. If you need to reproduce coordinates projected with this slightly
  319. different eccentricity, you should specify your own ellipsoid with the
  320. same parameters as Clarke 1866, but with f = 1/294.97861076. Also, be
  321. aware that older data may be referenced to different datums, and unless
  322. you know which datum was used and convert all data to a common datum you
  323. may experience mismatches of tens to hundreds of meters. (3) Finally, be
  324. aware that :term:`PROJ_SCALE_FACTOR` have certain default values for some
  325. projections so you may have to override the setting in order to match
  326. results produced with other settings.
  327. Output Order
  328. ------------
  329. The production order for the geodetic and temporal columns produced by the
  330. options **-A**, **-G**, **-L**, and **-Z** is fixed and follows the
  331. alphabetical order of the options. Hence, the order these options
  332. appear on the command line is irrelevant. The actual output order
  333. can of course be modulated via **-o**.
  334. See Also
  335. --------
  336. :doc:`gmt`, :doc:`gmt.conf`,
  337. :doc:`gmtvector`,
  338. :doc:`project`
  339. References
  340. ----------
  341. Bomford, G., 1952, Geodesy, Oxford U. Press.
  342. Snyder, J. P., 1987, Map Projections - A Working Manual, U.S. Geological
  343. Survey Prof. Paper 1395.
  344. Vanicek, P. and Krakiwsky, E, 1982, Geodesy - The Concepts,
  345. North-Holland Publ., ISBN: 0 444 86149 1.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...