1GMTDP(1) Generic Mapping Tools GMTDP(1)
2
3
4
6 gmtdp - Line reduction using the Douglas-Peucker algorithm
7
9 gmtdp infiles -Ttolerance [ -H[i][nrec] ] [ -V ] [ -:[i|o] ] [
10 -b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ -bo[s|S|d|D[ncol]|c[var1/...]] ]
11 [ -m[i|o][flag] ]
12
14 gmtdp reads one or more data files (which may be multisegment files;
15 see -m) and apply the Douglas-Peucker line simplification algorithm.
16 The method recursively subdivides a polygon until a run of points can
17 be replaced by a straight line segment, with no point in that run devi‐
18 ating from the straight line by more than the tolerance. Have a look
19 at this site to get a visual insight on how the algorithm works
20 http://geometryalgorithms.com/Archive/algorithm_0205/algorithm_0205.htm
21 WARNING: currently this program should be used only with geographical
22 coordinates.
23
24 file(s)
25 One of more data files. If none are supplied then we read stan‐
26 dard input.
27
29 -T Specifies the maximum mismatch tolerance in km.
30
31 -H Input file(s) has header record(s). If used, the default number
32 of header records is N_HEADER_RECS. Use -Hi if only input data
33 should have header records [Default will write out header
34 records if the input data have them]. Blank lines and lines
35 starting with # are always skipped.
36
37 -V Selects verbose mode, which will send progress reports to stderr
38 [Default runs "silently"].
39
40 -: Toggles between (longitude,latitude) and (latitude,longitude)
41 input and/or output. [Default is (longitude,latitude)]. Append
42 i to select input only or o to select output only. [Default
43 affects both].
44
45 -bi Selects binary input. Append s for single precision [Default is
46 d (double)]. Uppercase S or D will force byte-swapping.
47 Optionally, append ncol, the number of columns in your binary
48 input file if it exceeds the columns needed by the program. Or
49 append c if the input file is netCDF. Optionally, append
50 var1/var2/... to specify the variables to be read. [Default is
51 2 input columns].
52
53 -bo Selects binary output. Append s for single precision [Default
54 is d (double)]. Uppercase S or D will force byte-swapping.
55 Optionally, append ncol, the number of desired columns in your
56 binary output file. [Default is same as input].
57
58 -f Special formatting of input and/or output columns (time or geo‐
59 graphical data). Specify i or o to make this apply only to
60 input or output [Default applies to both]. Give one or more
61 columns (or column ranges) separated by commas. Append T (abso‐
62 lute calendar time), t (relative time in chosen TIME_UNIT since
63 TIME_EPOCH), x (longitude), y (latitude), or f (floating point)
64 to each column or column range item. Shorthand -f[i|o]g means
65 -f[i|o]0x,1y (geographic coordinates).
66
67 -m Multiple segment file(s). Segments are separated by a special
68 record. For ASCII files the first character must be flag
69 [Default is '>']. For binary files all fields must be NaN and
70 -b must set the number of output columns explicitly. By default
71 the -m setting applies to both input and output. Use -mi and
72 -mo to give separate settings to input and output.
73
75 The ASCII output formats of numerical data are controlled by parameters
76 in your .gmtdefaults4 file. Longitude and latitude are formatted
77 according to OUTPUT_DEGREE_FORMAT, whereas other values are formatted
78 according to D_FORMAT. Be aware that the format in effect can lead to
79 loss of precision in the output, which can lead to various problems
80 downstream. If you find the output is not written with enough preci‐
81 sion, consider switching to binary output (-bo if available) or specify
82 more decimals using the D_FORMAT setting.
83
85 To reduce the line segment.d using a tolerance of 2 km, run
86
87 gmtdp segment.d -T2 > new_segment.d
88
89
91 Douglas, D. H., and T. K. Peucker, Algorithms for the reduction of the
92 number of points required to represent a digitized line of its carica‐
93 ture, Can. Cartogr., 10, 112-122, 1973.
94 This implementation of the algorithm has been kindly provided by Dr.
95 Gary J. Robinson, Environmental Systems Science Centre, University of
96 Reading, Reading, UK (gazza@mail.nerc-essc.ac.uk); his subroutine forms
97 the basis for this program.
98
100 GMT(1)
101
102
103
104GMT 4.5.6 10 Mar 2011 GMTDP(1)