1GMTSTITCH(1)                 Generic Mapping Tools                GMTSTITCH(1)
2
3
4

NAME

6       gmtstitch - Join line segments whose end points match within tolerance
7

SYNOPSIS

9       gmtstitch [ infiles ] [ -C[closed] ] [ -D[template] ] [ -H[i][nrec] ] [
10       -L[linkfile] ] [ -Q[template] ] [ -Tcutoff[m|c|e|E|k|K][/nn_dist]  ]  [
11       -V   ]   [   -:[i|o]   ]   [   -b[i|o][s|S|d|D[ncol]|c[var1/...]]  ]  [
12       -bo[s|S|d|D[ncol]|c[var1/...]] ] [ -m[i|o][flag] ]
13

DESCRIPTION

15       gmtstitch reads one or more  data  files  (which  may  be  multisegment
16       files;  see  -m)  and examines the coordinates of the end points of all
17       line segments.  If a pair of end points are identical or closer to each
18       other  than  the  specified separation tolerance then the two line seg‐
19       ments are joined into a single segment.  The process repeats until  all
20       the  remaining endpoints no longer pass the tolerance test; the result‐
21       ing segments are then written out to standard output.   It  it  is  not
22       clear what the separation tolerance should be then use -L to get a list
23       of all separation distances and analyze them to  determine  a  suitable
24       cutoff.
25
26       file(s)
27              One of more data files.  If none are supplied then we read stan‐
28              dard input.
29

OPTIONS

31       -C     Write all the closed polygons to closed [gmtstitch_closed.d] and
32              all  other  segments  as they are to stdout.  No stitching takes
33              place.  Use -Tcutoff to set a minimum  separation  [0],  and  if
34              cutoff is > 0 then we also close the polygons on output.
35
36       -D     For  multiple segment data, dump each segment to a separate out‐
37              put file [Default writes a multiple  segment  file  to  stdout].
38              Append  a  format  template  for the individual file names; this
39              template must contain a C format specifier that  can  format  an
40              integer  argument  (the  segment number); this is usually %d but
41              could be %8.8d which gives leading zeros,  etc.  Optionally,  it
42              may  also  contain  the  format %c before the integer; this will
43              then be replaced by C (closed) or O (open) to  indicate  segment
44              type.   [Default  is gmtstitch_segment_%d.d].  Note that segment
45              headers will be written in either case.  For composite segments,
46              a generic segment header will be written and the segment headers
47              of individual pieces will be written out as comments to make  it
48              possible to identify where the stitched pieces came from.
49
50       -H     Input file(s) has header record(s).  If used, the default number
51              of header records is N_HEADER_RECS.  Use -Hi if only input  data
52              should  have  header  records  [Default  will  write  out header
53              records if the input data have  them].  Blank  lines  and  lines
54              starting with # are always skipped.
55
56       -L     Writes the link information to the specified file [links.d]. For
57              each segment we write the  original  segment  id,  and  for  the
58              beginning  and  end point of the segment we report the id of the
59              closest segment, whether it is the  beginning  (B)  or  end  (E)
60              point  that is closest, and the distance between those points in
61              units determined by -T.
62
63       -Q     Used with -D to a list file with the  names  of  the  individual
64              output  files.   Optionally,  append a filename template for the
65              individual file names; this template  may  contain  a  C  format
66              specifier  that  can  format  an character (C or O for closed or
67              open, respectively). [Default is gmtstitch_list.d].
68
69       -T     Specifies the separation tolerance in the data coordinate  units
70              [0].  Append m or c for minutes or seconds, or e or k for meters
71              or km (implies -fg using use flat Earth approximation.  Use E or
72              K  for exact geodesic distances; however.  if the current ELLIP‐
73              SOID is Sphere then spherical great circle distances  are  used.
74              If two lines has endpoints that are closer than this cutoff they
75              will be joined.  Optionally,  append  /nn_dist  which  adds  the
76              requirement  that a link will only be made if the second closest
77              connection exceeds the nn_dist.  The latter distance is  assumed
78              to be in the same units as cutoff.
79
80       -V     Selects verbose mode, which will send progress reports to stderr
81              [Default runs "silently"].
82
83       -:     Toggles between  (longitude,latitude)  and  (latitude,longitude)
84              input and/or output.  [Default is (longitude,latitude)].  Append
85              i to select input only or o to  select  output  only.   [Default
86              affects both].
87
88       -bi    Selects binary input.  Append s for single precision [Default is
89              d  (double)].   Uppercase  S  or  D  will  force  byte-swapping.
90              Optionally,  append  ncol,  the number of columns in your binary
91              input file if it exceeds the columns needed by the program.   Or
92              append  c  if  the  input  file  is  netCDF.  Optionally, append
93              var1/var2/... to specify the variables to be read.  [Default  is
94              2 input columns].
95
96       -bo    Selects  binary  output.  Append s for single precision [Default
97              is d (double)].  Uppercase S  or  D  will  force  byte-swapping.
98              Optionally,  append  ncol, the number of desired columns in your
99              binary output file.  [Default is same as input].
100
101       -f     Special formatting of input and/or output columns (time or  geo‐
102              graphical  data).   Specify  i  or  o to make this apply only to
103              input or output [Default applies to both].   Give  one  or  more
104              columns (or column ranges) separated by commas.  Append T (abso‐
105              lute calendar time), t (relative time in chosen TIME_UNIT  since
106              TIME_EPOCH),  x (longitude), y (latitude), or f (floating point)
107              to each column or column range item.  Shorthand  -f[i|o]g  means
108              -f[i|o]0x,1y (geographic coordinates).
109
110       -m     Multiple  segment  file(s).  Segments are separated by a special
111              record.  For ASCII  files  the  first  character  must  be  flag
112              [Default  is  '>'].  For binary files all fields must be NaN and
113              -b must set the number of output columns explicitly.  By default
114              the  -m  setting  applies to both input and output.  Use -mi and
115              -mo to give separate settings to input and output.
116

ASCII FORMAT PRECISION

118       The ASCII output formats of numerical data are controlled by parameters
119       in  your  .gmtdefaults4  file.   Longitude  and  latitude are formatted
120       according to OUTPUT_DEGREE_FORMAT, whereas other values  are  formatted
121       according  to D_FORMAT.  Be aware that the format in effect can lead to
122       loss of precision in the output, which can  lead  to  various  problems
123       downstream.   If  you find the output is not written with enough preci‐
124       sion, consider switching to binary output (-bo if available) or specify
125       more decimals using the D_FORMAT setting.
126

EXAMPLES

128       To  combine the digitized multisegment lines segment_*.d (whose coordi‐
129       nates are in cm) into as few complete lines as possible,  assuming  the
130       end points slop could be up to 0.1 mm, run
131
132       gmtstitch segment_*.d -Tf0.1 -m > new_segments.d
133
134       To  combine  the digitized segments in the multisegment file my_lines.d
135       (whose coordinates are in lon,lat) into as few complete lines as possi‐
136       ble,  assuming  the end points slop could be up to 150 m, and write the
137       complete  segments  to  separate  files  called   Map_segment_0001.dat,
138       Map_segment_0002.dat, etc., run
139
140       gmtstitch my_lines.d -Tf0.15k -m -DMap_segment_%4.4d.dat
141
142

SEE ALSO

144       GMT(1), mapproject(1)
145
146
147
148GMT 4.5.6                         10 Mar 2011                     GMTSTITCH(1)
Impressum