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

gmtconnect.rst 6.1 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
  1. .. index:: ! gmtconnect
  2. .. include:: module_core_purpose.rst_
  3. **********
  4. gmtconnect
  5. **********
  6. |gmtconnect_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt connect** [ *table* ] [ |-C|\ [*closed*] ]
  11. [ |-D|\ [*template*] ] [ |-L|\ [*linkfile*] ]
  12. [ |-Q|\ [*template*] ] [ |-T|\ [*cutoff*\ [**+s**\ *sdist*]] ]
  13. [ |SYN_OPT-V| ]
  14. [ |SYN_OPT-b| ]
  15. [ |SYN_OPT-d| ]
  16. [ |SYN_OPT-e| ]
  17. [ |SYN_OPT-f| ]
  18. [ |SYN_OPT-g| ]
  19. [ |SYN_OPT-h| ]
  20. [ |SYN_OPT-i| ]
  21. [ |SYN_OPT-o| ]
  22. [ |SYN_OPT-q| ]
  23. [ |SYN_OPT-:| ]
  24. [ |SYN_OPT--| ]
  25. |No-spaces|
  26. Description
  27. -----------
  28. **connect** reads standard input or one or more data files, which may
  29. be multisegment files, and examines the coordinates of the end points of
  30. all line segments. If a pair of end points are identical or closer to
  31. each other than the specified separation *cutoff* then the two line
  32. segments are joined into a single segment. The process repeats until all
  33. the remaining endpoints no longer pass the tolerance test; the resulting
  34. segments are then written out to standard output or specified output
  35. file. If it is not clear what the separation tolerance should be then
  36. use **-L** to get a list of all separation distances and analyze them to
  37. determine a suitable cutoff.
  38. Required Arguments
  39. ------------------
  40. None.
  41. Optional Arguments
  42. ------------------
  43. .. |Add_intables| unicode:: 0x20 .. just an invisible code
  44. .. include:: explain_intables.rst_
  45. .. _-C:
  46. **-C**\ [*closed*]
  47. Write all the already-closed polygons to file *closed* [gmtconnect_closed.txt]
  48. and all open segments to *stdout*. No connection will take
  49. place. Use **-T**\ *cutoff* to set a minimum separation [0], and then
  50. any existing polygon whose first and last point are separated by less
  51. that *cutoff* will be considered to be closed. Note that if
  52. *cutoff* is > 0 then we explicitly close all polygons on output.
  53. .. _-D:
  54. **-D**\ [*template*]
  55. For multiple segment data, dump each segment to a separate output
  56. file [Default writes a single multiple segment file]. Append a
  57. format template for the individual file names; this template
  58. **must** contain a C format specifier that can format an integer
  59. argument (the segment number); this is usually %d but could be %08d
  60. for leading zeros, etc. Optionally, it may also contain the
  61. format %c *before* the integer; this will then be replaced by C
  62. (closed) or O (open) to indicate segment type. [Default is
  63. gmtconnect_segment_%d.txt]. Note that segment headers will be
  64. written in either case. For composite segments, a generic segment
  65. header will be written and the segment headers of individual pieces
  66. will be written out as comments to make it possible to identify
  67. where the connected pieces came from.
  68. .. _-L:
  69. **-L**\ [*linkfile*]
  70. Writes link information to the specified file
  71. [gmtconnect_link.txt]. For each segment we write the original
  72. segment id, and for the beginning and end point of the segment we
  73. report the id of the nearest segment, whether it is the beginning
  74. (B) or end (E) point that is closest, and the distance between those
  75. points in units determined by **-T**.
  76. .. _-Q:
  77. **-Q**\ [*template*]
  78. Used with **-D** to write a list file with the names of the individual
  79. output files. Optionally, append a filename template for the
  80. individual file names; this template **may** contain a C format
  81. specifier that can format an character (C or O for closed or open,
  82. respectively). [Default is gmtconnect_list.txt].
  83. .. _-T:
  84. **-T**\ [*cutoff*\ [**+s**\ *sdist*]]
  85. Specifies the separation tolerance in the data coordinate units [0]; for geographic data
  86. append distance unit (see `Units`_). If two lines have end-points that
  87. are closer than *cutoff* they will be joined. Optionally, append
  88. **+s**\ *sdist* which adds the extra requirement that a link will only be made
  89. if the *second* closest connection exceeds the *sdist* distance. The latter
  90. distance must be given in the same units as *cutoff*. However, if **-T** is
  91. no arguments then we close every line segment or polygon *regardless* of
  92. the gap distance between the first and last point in the segment.
  93. .. _-V:
  94. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  95. .. include:: explain_-V.rst_
  96. .. |Add_-bi| replace:: [Default is 2 input columns].
  97. .. include:: explain_-bi.rst_
  98. .. |Add_-bo| replace:: [Default is same as input].
  99. .. include:: explain_-bo.rst_
  100. .. |Add_-d| unicode:: 0x20 .. just an invisible code
  101. .. include:: explain_-d.rst_
  102. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  103. .. include:: explain_-e.rst_
  104. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  105. .. include:: explain_-f.rst_
  106. .. |Add_-g| unicode:: 0x20 .. just an invisible code
  107. .. include:: explain_-g.rst_
  108. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  109. .. include:: explain_-h.rst_
  110. .. include:: explain_-icols.rst_
  111. .. include:: explain_-ocols.rst_
  112. .. include:: explain_-q.rst_
  113. .. include:: explain_colon.rst_
  114. .. include:: explain_help.rst_
  115. .. include:: explain_distunits.rst_
  116. .. include:: explain_precision.rst_
  117. Examples
  118. --------
  119. .. include:: explain_example.rst_
  120. To combine the digitized segment lines segment\_\*.txt (whose Cartesian
  121. coordinates are in cm) into as few complete lines as possible, assuming
  122. the end points' digitization error could be up to 0.1 mm, run::
  123. gmt connect segment_*.txt -T0.1 > new_segments.txt
  124. To combine the digitized segments in the multisegment file my_lines.txt
  125. (whose coordinates are in lon,lat) into as few complete lines as
  126. possible, assuming the end points digitization error could be up to 150 m, and write
  127. the complete segments to individual files called Map_segment_0001.txt,
  128. Map_segment_0002.txt, etc., run::
  129. gmt connect my_lines.txt -T150e -DMap_segment_%04d.txt
  130. Bugs
  131. ----
  132. The line connection does not work if a line only has a single point.
  133. However, **connect** will correctly add the point to the nearest segment.
  134. Running **connect** again on the new set of lines will eventually connect
  135. all lines that satisfy the criteria given in **-T**.
  136. See Also
  137. --------
  138. :doc:`gmt`,
  139. :doc:`gmt.conf`,
  140. :doc:`gmtsimplify`,
  141. :doc:`gmtspatial`,
  142. :doc:`mapproject`
Tip!

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

Comments

Loading...