1GMTSIMPLIFY(1)                        GMT                       GMTSIMPLIFY(1)
2
3
4

NAME

6       gmtsimplify - Line reduction using the Douglas-Peucker algorithm
7

SYNOPSIS

9       gmtsimplify  [ table ]  -Ttolerance[unit] [  -V[level] ] [ -bbinary ] [
10       -dnodata ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders ] [  -iflags
11       ] [ -oflags ] [ -:[i|o] ]
12
13       Note:  No  space  is allowed between the option flag and the associated
14       arguments.
15

DESCRIPTION

17       gmtsimplify reads one or more data files and apply the  Douglas-Peucker
18       line  simplification  algorithm.  The  method  recursively subdivides a
19       polygon until a run of points can be replaced by a straight  line  seg‐
20       ment,  with  no  point  in that run deviating from the straight line by
21       more than the tolerance. Have a look at  this  site  to  get  a  visual
22       insight       on       how       the       algorithm      works      (‐
23       http://geometryalgorithms.com/Archive/algorithm_0205/algo
24       rithm_0205.htm)
25

REQUIRED ARGUMENTS

27       -Ttolerance[unit]
28              Specifies  the  maximum mismatch tolerance in the user units. If
29              the data is not Cartesian then append  the  distance  unit  (see
30              UNITS).
31

OPTIONAL ARGUMENTS

33       table  One  or  more ASCII (or binary, see -bi[ncols][type]) data table
34              file(s) holding a number of data columns. If no tables are given
35              then we read from standard input.
36
37       -V[level] (more ...)
38              Select verbosity level [c].
39
40       -bi[ncols][t] (more ...)
41              Select native binary input. [Default is 2 input columns].
42
43       -bo[ncols][type] (more ...)
44              Select native binary output. [Default is same as input].
45
46       -d[i|o]nodata (more ...)
47              Replace  input  columns  that  equal  nodata with NaN and do the
48              reverse on output.
49
50       -e[~]"pattern" | -e[~]/regexp/[i] (more ...)
51              Only accept data records that match the given pattern.
52
53       -f[i|o]colinfo (more ...)
54              Specify data types of input and/or output columns.
55
56       -g[a]x|y|d|X|Y|D|[col]z[+|-]gap[u] (more ...)
57              Determine data gaps and line breaks.
58
59       -h[i|o][n][+c][+d][+rremark][+rtitle] (more ...)
60              Skip or produce header record(s).
61
62       -icols[+l][+sscale][+ooffset][,...] (more ...)
63              Select input columns and transformations (0 is first column).
64
65       -ocols[,...] (more ...)
66              Select output columns (0 is first column).
67
68       -:[i|o] (more ...)
69              Swap 1st and 2nd column on input and/or output.
70
71       -^ or just -
72              Print a short message about the  syntax  of  the  command,  then
73              exits (NOTE: on Windows just use -).
74
75       -+ or just +
76              Print  an extensive usage (help) message, including the explana‐
77              tion of any module-specific  option  (but  not  the  GMT  common
78              options), then exits.
79
80       -? or no arguments
81              Print a complete usage (help) message, including the explanation
82              of all options, then exits.
83

UNITS

85       For map distance unit, append unit d for arc degree, m for arc  minute,
86       and s for arc second, or e for meter [Default], f for foot, k for km, M
87       for statute mile, n for nautical mile, and u for  US  survey  foot.  By
88       default  we compute such distances using a spherical approximation with
89       great circles. Prepend - to a distance (or the unit is no  distance  is
90       given) to perform "Flat Earth" calculations (quicker but less accurate)
91       or prepend + to perform exact geodesic calculations  (slower  but  more
92       accurate).
93

ASCII FORMAT PRECISION

95       The ASCII output formats of numerical data are controlled by parameters
96       in your gmt.conf file. Longitude and latitude are  formatted  according
97       to   FORMAT_GEO_OUT,  absolute  time  is  under  the  control  of  FOR‐
98       MAT_DATE_OUT and FORMAT_CLOCK_OUT, whereas general floating point  val‐
99       ues are formatted according to FORMAT_FLOAT_OUT. Be aware that the for‐
100       mat in effect can lead to loss of precision in ASCII output, which  can
101       lead  to  various  problems  downstream.  If you find the output is not
102       written with enough precision, consider switching to binary output (-bo
103       if  available) or specify more decimals using the FORMAT_FLOAT_OUT set‐
104       ting.
105

EXAMPLES

107       To reduce the geographic line segment.d using a tolerance of 2 km, run
108
109              gmt simplify segment.d -T2k > new_segment.d
110
111       To reduce the Cartesian lines xylines.d using a tolerance of  0.45  and
112       write the reduced lines to file new_xylines.d, run
113
114              gmt simplify xylines.d -T0.45 > new_xylines.d
115

NOTES

117       There  is a slight difference in how gmtsimplify processes lines versus
118       closed polygons.  Segments that are explicitly closed will  be  consid‐
119       ered  polygons,  otherwise we treat them as line segments.  Hence, seg‐
120       ments recognized as polygons may reduce to a 3-point  polygon  with  no
121       area; these are suppressed from the output.
122

BUGS

124       One  known  issue  with  the Douglas-Peucker has to do with crossovers.
125       Specifically, it cannot be guaranteed that the reduced  line  does  not
126       cross  itself.  Depending  on  how many lines you are considering it is
127       also possible that reduced lines may  intersect  other  reduced  lines.
128       Finally,  the  current implementation only does Flat Earth calculations
129       even if you specify spherical; gmtsimplify will  issue  a  warning  and
130       reset the calculation mode to Flat Earth.
131

REFERENCES

133       Douglas,  D. H., and T. K. Peucker, Algorithms for the reduction of the
134       number of points required to represent a digitized line of its  carica‐
135       ture, Can. Cartogr., 10, 112-122, 1973.
136
137       This  implementation  of  the algorithm has been kindly provided by Dr.
138       Gary J. Robinson, Department of  Meteorology,  University  of  Reading,
139       Reading, UK; his subroutine forms the basis for this program.
140

SEE ALSO

142       gmt, gmt.conf, gmtconnect, gmtconvert, gmtselect
143
145       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
146
147
148
149
1505.4.5                            Feb 24, 2019                   GMTSIMPLIFY(1)
Impressum