1GMTSTITCH(1) Generic Mapping Tools GMTSTITCH(1)
2
3
4
6 gmtstitch - Join line segments whose end points match within tolerance
7
9 gmtstitc infiles [ -D[template] ] [ -H[i][nrec] ] [ -M[i|o][flag] ] [
10 -Tcutoff[m|c|k|K] ] [ -V ] [ -:[i|o] ] [
11 -b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ -bo[s|S|d|D[ncol]|c[var1/...]] ]
12
14 gmtstitch reads one or more data files (which may be multisegment
15 files; see -M) and examines the coordinates of the end points of all
16 line segments. If a pair of end points are identical or closer to each
17 other than the specified separation tolerance then the two line seg‐
18 ments are joined into a single segment. The process repeats until all
19 the remaining endpoints no longer pass the tolerance test; the result‐
20 ing segments are then written out to standard output.
21
22 file(s)
23 One of more data files. If none are supplied then we read stan‐
24 dard input.
25
27 -D For multiple segment data, dump each segment to a separate out‐
28 put file [Default writes a multiple segment file to stdout].
29 Append a format template for the individual file names; this
30 template must contain a C format specifier that can format an
31 integer argument (the segment number); this is usually %d but
32 could be %8.8d which gives leading zeros, etc. [Default is gmt‐
33 stitch_segment_%d.d].
34
35 -H Input file(s) has Header record(s). Number of header records
36 can be changed by editing your .gmtdefaults4 file. If used, GMT
37 default is 1 header record. Use -Hi if only input data should
38 have header records [Default will write out header records if
39 the input data have them]. Blank lines and lines starting with #
40 are always skipped.
41
42 -M Multiple segment file(s). Segments are separated by a special
43 record. For ASCII files the first character must be flag
44 [Default is '>']. For binary files all fields must be NaN and
45 -b must set the number of output columns explicitly. By default
46 the -M setting applies to both input and output. Use -Mi and
47 -Mo to give separate settings.
48
49 -T Specifies the separation tolerance in the data coordinate units
50 [0]. Append m or c for minutes or seconds, k for km (implies
51 -fg and use flat Earth approximation, or K for km (implies -fg,
52 and use exact geodesic distances. If the current ELLIPSOID is
53 Sphere then spherical great circle distances are used. If two
54 lines has endpoints that are closer than this cutoff they will
55 be joined.
56
57 -V Selects verbose mode, which will send progress reports to stderr
58 [Default runs "silently"].
59
60 -: Toggles between (longitude,latitude) and (latitude,longitude)
61 input and/or output. [Default is (longitude,latitude)]. Append
62 i to select input only or o to select output only. [Default
63 affects both].
64
65 -bi Selects binary input. Append s for single precision [Default is
66 d (double)]. Uppercase S or D will force byte-swapping.
67 Optionally, append ncol, the number of columns in your binary
68 input file if it exceeds the columns needed by the program. Or
69 append c if the input file is netCDF. Optionally, append
70 var1/var2/... to specify the variables to be read. [Default is
71 2 input columns].
72
73 -bo Selects binary output. Append s for single precision [Default
74 is d (double)]. Uppercase S or D will force byte-swapping.
75 Optionally, append ncol, the number of desired columns in your
76 binary output file. [Default is same as input].
77
78 -f Special formatting of input and/or output columns (time or geo‐
79 graphical data). Specify i or o to make this apply only to
80 input or output [Default applies to both]. Give one or more
81 columns (or column ranges) separated by commas. Append T (abso‐
82 lute calendar time), t (relative time in chosen TIME_UNIT since
83 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
84 to each column or column range item. Shorthand -f[i|o]g means
85 -f[i|o]0x,1y (geographic coordinates).
86
88 The ASCII output formats of numerical data are controlled by parameters
89 in your .gmtdefaults4 file. Longitude and latitude are formatted
90 according to OUTPUT_DEGREE_FORMAT, whereas other values are formatted
91 according to D_FORMAT. Be aware that the format in effect can lead to
92 loss of precision in the output, which can lead to various problems
93 downstream. If you find the output is not written with enough preci‐
94 sion, consider switching to binary output (-bo if available) or specify
95 more decimals using the D_FORMAT setting.
96
98 To combine the digitized multisegment lines segment_*.d (whose coordi‐
99 nates are in cm) into as few complete lines as possible, assuming the
100 end points slop could be up to 0.1 mm, run
101
102 gmtstitch segment_*.d -Tf0.1 -M > new_segments.d
103
104 To combine the digitized segments in the multisegment file my_lines.d
105 (whose coordinates are in lon,lat) into as few complete lines as possi‐
106 ble, assuming the end points slop could be up to 150 m, and write the
107 complete segments to separate files called Map_segment_0001.dat,
108 Map_segment_0002.dat, etc., run
109
110 gmtstitch my_lines.d -Tf0.15k -M -DMap_segment_%4.4d.dat
111
112
114 GMT(1), mapproject(1)
115
116
117
118GMT 4.3.1 15 May 2008 GMTSTITCH(1)