1GMTCONNECT(1)                         GMT                        GMTCONNECT(1)
2
3
4

NAME

6       gmtconnect  -  Connect  individual  lines whose end points match within
7       tolerance
8

SYNOPSIS

10       gmtconnect [ table ] [  -C[closed] ] [  -D[template] ] [   -L[linkfile]
11       ]  [   -Q[template]  ] [  -T[cutoff[unit][/nn_dist]] ] [  -V[level] ] [
12       -bbinary ] [ -dnodata ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders
13       ] [ -iflags ] [ -oflags ] [ -:[i|o] ]
14
15       Note:  No  space  is allowed between the option flag and the associated
16       arguments.
17

DESCRIPTION

19       gmtconnect reads standard input or one or more data files, which may be
20       multisegment  files,  and examines the coordinates of the end points of
21       all line segments. If a pair of end points are identical or  closer  to
22       each  other  than  the specified separation tolerance then the two line
23       segments are joined into a single segment. The  process  repeats  until
24       all  the  remaining  endpoints  no  longer pass the tolerance test; the
25       resulting segments are then written out to standard output or specified
26       output file. If it is not clear what the separation tolerance should be
27       then use -L to get a list of all separation distances and analyze  them
28       to determine a suitable cutoff.
29

REQUIRED ARGUMENTS

31       None.
32

OPTIONAL ARGUMENTS

34       table  One  or  more ASCII (or binary, see -bi[ncols][type]) data table
35              file(s) holding a number of data columns. If no tables are given
36              then we read from standard input.
37
38       -C[closed]
39              Write  all the closed polygons to closed [gmtconnect_closed.txt]
40              and all other segments as they  are  to  stdout.  No  connection
41              takes  place.  Use -Tcutoff to set a minimum separation [0], and
42              if cutoff is > 0 then we also explicitly close the  polygons  on
43              output.
44
45       -D[template]
46              For  multiple segment data, dump each segment to a separate out‐
47              put file [Default writes a single multiple segment file]. Append
48              a  format  template for the individual file names; this template
49              must contain a C format specifier that  can  format  an  integer
50              argument  (the  segment number); this is usually %d but could be
51              %08d which gives leading zeros, etc.  Optionally,  it  may  also
52              contain  the  format  %c  before  the integer; this will then be
53              replaced by C (closed) or O (open)  to  indicate  segment  type.
54              [Default  is gmtconnect_segment_%d.txt]. Note that segment head‐
55              ers will be written in either case. For  composite  segments,  a
56              generic  segment  header will be written and the segment headers
57              of individual pieces will be written out as comments to make  it
58              possible to identify where the connected pieces came from.
59
60       -L[linkfile]
61              Writes  the  link  information  to  the  specified file [gmtcon‐
62              nect_link.txt]. For each segment we write the  original  segment
63              id, and for the beginning and end point of the segment we report
64              the id of the closest segment, whether it is the  beginning  (B)
65              or end (E) point that is closest, and the distance between those
66              points in units determined by -T.
67
68       -Q[template]
69              Used with -D to a list file with the  names  of  the  individual
70              output  files.  Optionally,  append  a filename template for the
71              individual file names; this template  may  contain  a  C  format
72              specifier  that  can  format  an character (C or O for closed or
73              open, respectively). [Default is gmtconnect_list.txt].
74
75       -T[cutoff[unit][/nn_dist]]
76              Specifies the separation tolerance in the data coordinate  units
77              [0];  append  distance  unit  (see  UNITS).  If  two  lines  has
78              end-points that are closer than this cutoff they will be joined.
79              Optionally,  append  /nn_dist  which adds the requirement that a
80              link will only be made if the second closest connection  exceeds
81              the nn_dist. The latter distance must be given in the same units
82              as cutoff.  However, if no arguments are  given  then  we  close
83              every  polygon  regardless  of  the  gap  between first and last
84              point.
85
86       -V[level] (more ...)
87              Select verbosity level [c].
88
89       -bi[ncols][t] (more ...)
90              Select native binary input. [Default is 2 input columns].
91
92       -bo[ncols][type] (more ...)
93              Select native binary output. [Default is same as input].
94
95       -d[i|o]nodata (more ...)
96              Replace input columns that equal nodata  with  NaN  and  do  the
97              reverse on output.
98
99       -e[~]"pattern" | -e[~]/regexp/[i] (more ...)
100              Only accept data records that match the given pattern.
101
102       -f[i|o]colinfo (more ...)
103              Specify data types of input and/or output columns.
104
105       -g[a]x|y|d|X|Y|D|[col]z[+|-]gap[u] (more ...)
106              Determine data gaps and line breaks.
107
108       -h[i|o][n][+c][+d][+rremark][+rtitle] (more ...)
109              Skip or produce header record(s).
110
111       -icols[+l][+sscale][+ooffset][,...] (more ...)
112              Select input columns and transformations (0 is first column).
113
114       -ocols[,...] (more ...)
115              Select output columns (0 is first column).
116
117       -:[i|o] (more ...)
118              Swap 1st and 2nd column on input and/or output.
119
120       -^ or just -
121              Print  a  short  message  about  the syntax of the command, then
122              exits (NOTE: on Windows just use -).
123
124       -+ or just +
125              Print an extensive usage (help) message, including the  explana‐
126              tion  of  any  module-specific  option  (but  not the GMT common
127              options), then exits.
128
129       -? or no arguments
130              Print a complete usage (help) message, including the explanation
131              of all options, then exits.
132

UNITS

134       For  map distance unit, append unit d for arc degree, m for arc minute,
135       and s for arc second, or e for meter [Default], f for foot, k for km, M
136       for  statute  mile,  n  for nautical mile, and u for US survey foot. By
137       default we compute such distances using a spherical approximation  with
138       great  circles.  Prepend - to a distance (or the unit is no distance is
139       given) to perform "Flat Earth" calculations (quicker but less accurate)
140       or  prepend  +  to perform exact geodesic calculations (slower but more
141       accurate).
142

ASCII FORMAT PRECISION

144       The ASCII output formats of numerical data are controlled by parameters
145       in  your  gmt.conf file. Longitude and latitude are formatted according
146       to  FORMAT_GEO_OUT,  absolute  time  is  under  the  control  of   FOR‐
147       MAT_DATE_OUT  and FORMAT_CLOCK_OUT, whereas general floating point val‐
148       ues are formatted according to FORMAT_FLOAT_OUT. Be aware that the for‐
149       mat  in effect can lead to loss of precision in ASCII output, which can
150       lead to various problems downstream. If you  find  the  output  is  not
151       written with enough precision, consider switching to binary output (-bo
152       if available) or specify more decimals using the FORMAT_FLOAT_OUT  set‐
153       ting.
154

EXAMPLES

156       To combine the digitized segment lines segment_*.txt (whose coordinates
157       are in cm) into as few complete lines as  possible,  assuming  the  end
158       points slop could be up to 0.1 mm, run
159
160              gmt connect segment_*.txt -Tf0.1 > new_segments.txt
161
162       To combine the digitized segments in the multisegment file my_lines.txt
163       (whose coordinates are in lon,lat) into as few complete lines as possi‐
164       ble,  assuming  the end points slop could be up to 150 m, and write the
165       complete  segments  to  separate  files  called   Map_segment_0001.dat,
166       Map_segment_0002.dat, etc., run
167
168              gmt connect my_lines.txt -T150e -DMap_segment_%04d.dat
169

BUGS

171       The  line  connection  does not work if a line only has a single point.
172       However, gmtconnect will correctly add the point to  the  nearest  seg‐
173       ment.  Running gmtconnect again on the new set of lines will eventually
174       connect all close lines.
175

SEE ALSO

177       gmt, gmt.conf, gmtsimplify, gmtspatial, mapproject
178
180       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
181
182
183
184
1855.4.5                            Feb 24, 2019                    GMTCONNECT(1)
Impressum