1v.generalize(1)               Grass User's Manual              v.generalize(1)
2
3
4

NAME

6       v.generalize  - Performs vector based generalization.
7

KEYWORDS

9       vector,  generalization,  simplification, smoothing, displacement, net‐
10       work generalization, topology, geometry
11

SYNOPSIS

13       v.generalize
14       v.generalize --help
15       v.generalize         [-lt]          input=name           [layer=string]
16       [type=string[,string,...]]   output=name   [error=name]   method=string
17       threshold=float         [look_ahead=integer]          [reduction=float]
18       [slide=float]        [angle_thresh=float]       [degree_thresh=integer]
19       [closeness_thresh=float]    [betweeness_thresh=float]     [alpha=float]
20       [beta=float]    [iterations=integer]   [cats=range]   [where=sql_query]
21       [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]
22
23   Flags:
24       -l
25           Disable loop support
26           Do not modify end points of lines forming a closed loop
27
28       -t
29           Do not copy attributes
30
31       --overwrite
32           Allow output files to overwrite existing files
33
34       --help
35           Print usage summary
36
37       --verbose
38           Verbose module output
39
40       --quiet
41           Quiet module output
42
43       --ui
44           Force launching GUI dialog
45
46   Parameters:
47       input=name [required]
48           Name of input vector map
49           Or data source for direct OGR access
50
51       layer=string
52           Layer number or name (’-1’ for all layers)
53           A single vector map can be connected to multiple  database  tables.
54           This  number  determines  which table to use. When used with direct
55           OGR access this is the layer name.
56           Default: -1
57
58       type=string[,string,...]
59           Input feature type
60           Options: line, boundary, area
61           Default: line,boundary,area
62
63       output=name [required]
64           Name for output vector map
65
66       error=name
67           Error map with failed generalizations
68           Lines and boundaries causing errors (collapsed to a point or topol‐
69           ogy errors)
70
71       method=string [required]
72           Generalization algorithm
73           Options:  douglas,  douglas_reduction,  lang,  reduction,  reumann,
74           boyle,  sliding_averaging,  distance_weighting,  chaiken,  hermite,
75           snakes, network, displacement
76           douglas: Douglas-Peucker Algorithm
77           douglas_reduction: Douglas-Peucker Algorithm with reduction parame‐
78           ter
79           lang: Lang Simplification Algorithm
80           reduction: Vertex Reduction Algorithm eliminates  points  close  to
81           each other
82           reumann: Reumann-Witkam Algorithm
83           boyle: Boyle’s Forward-Looking Algorithm
84           sliding_averaging: McMaster’s Sliding Averaging Algorithm
85           distance_weighting: McMaster’s Distance-Weighting Algorithm
86           chaiken: Chaiken’s Algorithm
87           hermite: Interpolation by Cubic Hermite Splines
88           snakes: Snakes method for line smoothing
89           network: Network generalization
90           displacement: Displacement of lines close to each other
91
92       threshold=float [required]
93           Maximal tolerance value
94           Options: 0-1000000000
95
96       look_ahead=integer
97           Look-ahead parameter
98           Default: 7
99
100       reduction=float
101           Percentage of the points in the output of ’douglas_reduction’ algo‐
102           rithm
103           Options: 0-100
104           Default: 50
105
106       slide=float
107           Slide of computed point toward the original point
108           Options: 0-1
109           Default: 0.5
110
111       angle_thresh=float
112           Minimum angle between two consecutive segments in Hermite method
113           Options: 0-180
114           Default: 3
115
116       degree_thresh=integer
117           Degree threshold in network generalization
118           Default: 0
119
120       closeness_thresh=float
121           Closeness threshold in network generalization
122           Options: 0-1
123           Default: 0
124
125       betweeness_thresh=float
126           Betweeness threshold in network generalization
127           Default: 0
128
129       alpha=float
130           Snakes alpha parameter
131           Default: 1.0
132
133       beta=float
134           Snakes beta parameter
135           Default: 1.0
136
137       iterations=integer
138           Number of iterations
139           Default: 1
140
141       cats=range
142           Category values
143           Example: 1,3,7-9,13
144
145       where=sql_query
146           WHERE conditions of SQL statement without ’where’ keyword
147           Example: income < 1000 and population >= 10000
148

DESCRIPTION

150       v.generalize is a module for the generalization of GRASS  vector  maps.
151       This  module  consists  of  algorithms  for  line  simplification, line
152       smoothing, network generalization and displacement (new methods may  be
153       added later).
154
155       If type=area is selected, boundaries of selected areas will be general‐
156       ized, and the options cats, where, and layer will  be  used  to  select
157       areas.
158

NOTES

160       (Line) simplification is a process of reducing the complexity of vector
161       features. The module transforms a line into another line consisting  of
162       fewer  vertices,  that still approximate the original line. Most of the
163       algorithms described below select a subset of points  on  the  original
164       line.
165
166       (Line) smoothing is a "reverse" process which takes as input a line and
167       produces a smoother approximate of the original. In some cases, this is
168       achieved  by  inserting  new  vertices  into the original line, and can
169       total up to 4000% of the number of vertices in the original. In such an
170       instance,  it  is always a good idea to simplify the line after smooth‐
171       ing.
172
173       Smoothing and simplification algorithms implemented in this module work
174       line by line, i.e. simplification/smoothing of one line does not affect
175       the other lines; they are treated separately. For isolated loops formed
176       by  a  single  line/boundary,  he  first  and  the  last  point of each
177       line/boundary can be translated and/or deleted, unless the -l  flag  is
178       used to disable loop support.
179
180       Lines  and  boundaries  are  not translated if they would collapse to a
181       single point. Boundaries are not translated  if  they  would  intersect
182       with  themselves or other boundaries. Such erroneous features are writ‐
183       ten to an optional error vector map. Overlaying the error map over  the
184       generalized map indicates the kind of error.  Lines/boundaries collaps‐
185       ing to a point are written out as points, boundaries violating topology
186       are  written  out as boundaries. The error map can be overlaid over the
187       generalized map to understand why some features were not generalized.
188
189   SIMPLIFICATION
190       Simplification can fail  for  many  boundaries  if  the  simplification
191       parameters  would  result  in  a  large  reduction of vertices. If many
192       lines/boundaries could not be simplified, try different parameters that
193       would cause a lower degree of simplification.
194
195       v.generalize contains following line simplification algorithms:
196
197           ·   Douglas-Peucker Algorithm
198
199           ·   Douglas-Peucker Reduction Algorithm
200
201           ·   Lang Algorithm
202
203           ·   Vertex Reduction
204
205           ·   Reumann-Witkam Algorithm
206
207           ·   Remove Small Lines/Areas
208       Different  algorithms  require  different parameters, but all the algo‐
209       rithms have one parameter in common: the threshold parameter, given  in
210       map  units  (for  latitude-longitude  locations: in decimal degree). In
211       general, the degree of simplification  increases  with  the  increasing
212       value of threshold.
213
214   ALGORITHM DESCRIPTIONS
215           ·   Douglas-Peucker  - "Quicksort" of line simplification, the most
216               widely used algorithm. Input parameters: input, threshold.  For
217               more information, see:
218               http://geomalgorithms.com/a16-_decimate-1.html.
219
220           ·   Douglas-Peucker  Reduction  Algorithm  is  essentially the same
221               algorithm as the algorithm above, the difference being that  it
222               takes  an additional reduction parameter which denotes the per‐
223               centage of the number of points on the new line with respect to
224               the  number  of  points on the original line. Input parameters:
225               input, threshold, reduction.
226
227           ·   Lang - Another standard  algorithm.  Input  parameters:  input,
228               threshold, look_ahead.  For an excellent description, see:
229               http://www.sli.unimelb.edu.au/gisweb/LGmodule/LGLangVisualisa
230               tion.htm.
231
232           ·   Vertex Reduction - Simplest among the algorithms. Input parame‐
233               ters:  input,  threshold.  Given a line, this algorithm removes
234               the points of this line which are closer  to  each  other  than
235               threshold.  More  precisely,  if  p1 and p2 are two consecutive
236               points, and the distance between p2 and p1 is less than thresh‐
237               old,  it removes p2 and repeats the same process on the remain‐
238               ing points.
239
240           ·   Reumann-Witkam -  Input  parameters:  input,  threshold.   This
241               algorithm quite reasonably preserves the global characteristics
242               of the lines. For more information, see for example:
243               http://psimpl.sourceforge.net/reumann-witkam.html.
244       Douglas-Peucker and Douglas-Peucker Reduction Algorithm  use  the  same
245       method to simplify the lines. Note that
246       v.generalize input=boundary_county output=boundary_county_dp20 method=douglas threshold=20
247       is equivalent to
248       v.generalize input=boundary_county output=boundary_county_dp_red20_100 \
249                    method=douglas_reduction threshold=20 reduction=100
250       However,  in  this  case, the first method is faster. Also observe that
251       douglas_reduction never outputs more vertices than douglas,  and  that,
252       in  general,  douglas  is  more  efficient than douglas_reduction. More
253       importantly, the effect of
254       v.generalize input=boundary_county output=boundary_county_dp_red0_30 \
255                    method=douglas_reduction threshold=0 reduction=30
256       is that ’out’ contains approximately only 30% of points of ’in’.
257
258   SMOOTHING
259       The following smoothing algorithms are implemented in v.generalize:
260
261           ·   Boyle’s Forward-Looking Algorithm - The position of each  point
262               depends  on  the  position of the previous points and the point
263               look_ahead ahead. look_ahead consecutive points. Input  parame‐
264               ters: input, look_ahead.
265
266           ·   McMaster’s  Sliding  Averaging  Algorithm  -  Input Parameters:
267               input, slide, look_ahead.  The new position of  each  point  is
268               the average of the look_ahead points around. Parameter slide is
269               used for linear interpolation between old and new position (see
270               below).
271
272           ·   McMaster’s  Distance-Weighting  Algorithm  - Takes the weighted
273               average of look_ahead consecutive points where  the  weight  is
274               the  reciprocal of the distance from the point to the currently
275               smoothed point. The parameter slide is used for linear interpo‐
276               lation  between  the  original  position of the point and newly
277               computed position where value 0 means  the  original  position.
278               Input parameters: input, slide, look_ahead.
279
280           ·   Chaiken’s  Algorithm - "Inscribes" a line touching the original
281               line such that the points on this new line are at least thresh‐
282               old  apart.  Input parameters: input, threshold. This algorithm
283               approximates the given line very well.
284
285           ·   Hermite Interpolation - This algorithm takes the points of  the
286               given  line  as  the control points of hermite cubic spline and
287               approximates this spline by the points approximately  threshold
288               apart.  This  method  has excellent results for small values of
289               threshold, but in this case it produces a huge  number  of  new
290               points and some simplification is usually needed.  Input param‐
291               eters: input, threshold, angle_thresh.   Angle_thresh  is  used
292               for  reducing the number of the points.  It denotes the minimal
293               angle (in degrees) between two consecutive segments of a line.
294
295           ·   Snakes is the method of minimisation of the "energy" of a line.
296               This  method preserves the general characteristics of the lines
297               but smooths the "sharp corners" of  a  line.  Input  parameters
298               input,  alpha,  beta.  This algorithm works very well for small
299               values of alpha and beta (between 0 and  5).  These  parameters
300               affect the "sharpness" and the curvature of the computed line.
301       One of the key advantages of Hermite Interpolation is the fact that the
302       computed line always passes through the points of  the  original  line,
303       whereas  the  lines  produced  by  the  remaining algorithms never pass
304       through these points. In some sense,  this  algorithm  outputs  a  line
305       which "circumscribes" the input line.
306
307       On the other hand, Chaiken’s Algorithm outputs a line which "inscribes"
308       a given line. The output line always touches/intersects the  centre  of
309       the  input line segment between two consecutive points. For more itera‐
310       tions, the property above does not hold, but  the  computed  lines  are
311       very  similar  to the Bezier Splines. The disadvantage of the two algo‐
312       rithms given above is that they increase the number  of  points.   How‐
313       ever, Hermite Interpolation can be used as another simplification algo‐
314       rithm. To achieve this, it is necessary to set angle_thresh  to  higher
315       values (15 or so).
316
317       One restriction on both McMasters’ Algorithms is that look_ahead param‐
318       eter must be odd. Also note that these algorithms  have  no  effect  if
319       look_ahead = 1.
320
321       Note  that  Boyle’s, McMasters’ and Snakes algorithm are sometimes used
322       in the signal processing to  smooth  the  signals.   More  importantly,
323       these  algorithms  never change the number of points on the lines; they
324       only translate the points, and do not insert any new points.
325
326       Snakes Algorithm is (asymptotically) the slowest among  the  algorithms
327       presented  above.  Also, it requires quite a lot of memory.  This means
328       that it is not very efficient for maps with  the  lines  consisting  of
329       many segments.
330
331   DISPLACEMENT
332       The  displacement  is  used  when the lines overlap and/or are close to
333       each other at the current level of  detail.  In  general,  displacement
334       methods  move the conflicting features apart so that they do not inter‐
335       act and can be distinguished.
336
337       This module implements an algorithm for displacement of linear features
338       based  on  the  Snakes approach. This method generally yields very good
339       results; however, it requires a lot of memory and  is  not  very  effi‐
340       cient.
341
342       Displacement  is selected by method=displacement. It uses the following
343       parameters:
344
345           ·   threshold - specifies critical distance. Two features  interact
346               if they are closer than threshold apart.
347
348           ·   alpha,  beta  -  These parameters define the rigidity of lines.
349               For larger values of alpha, beta (>=1), the  algorithm  does  a
350               better job at retaining the original shape of the lines, possi‐
351               bly at the expense of displacement distance. If the  values  of
352               alpha,  beta  are too small (<=0.001), then the lines are moved
353               sufficiently, but the geometry and topology  of  lines  can  be
354               destroyed.  Most likely the best way to find the good values of
355               alpha, beta is by trial and error.
356
357           ·   iterations - denotes the number of iterations the  interactions
358               between the lines are resolved. Good starting points for values
359               of iterations are between 10 and 100.
360       The lines affected by the algorithm can be specified by the layer, cats
361       and where parameters.
362
363   NETWORK GENERALIZATION
364       Used  for  selecting  "the most important" part of the network. This is
365       based on the graph algorithms. Network  generalization  is  applied  if
366       method=network.  The algorithm calculates three centrality measures for
367       each line in the network and only the lines  with  the  values  greater
368       than  thresholds  are  selected.   The  behaviour  of  algorithm can be
369       altered by the following parameters:
370
371           ·   degree_thresh - algorithm selects only the lines which share  a
372               point with at least degree_thresh different lines.
373
374           ·   closeness_thresh  -  is  always  in  the range (0, 1]. Only the
375               lines with the  closeness  centrality  value  at  least  close‐
376               ness_thresh  apart  are  selected. The lines in the centre of a
377               network have greater values of this measure than the lines near
378               the  border of a network. This means that this parameter can be
379               used for selecting the centre(s) of a  network.  Note  that  if
380               closeness_thresh=0 then everything is selected.
381
382           ·   betweeness_thresh  -  Again,  only  the lines with a betweeness
383               centrality measure at  least  betweeness_thresh  are  selected.
384               This value is always positive and is larger for large networks.
385               It denotes to what extent a line is in between the other  lines
386               in  the  network.  This  value is large for the lines which lie
387               between other lines and lie on the paths between two parts of a
388               network.  In  the terminology of road networks, these are high‐
389               ways, bypasses, main roads/streets, etc.
390       All three parameters above can be presented at the same time.  In  that
391       case, the algorithm selects only the lines which meet each criterion.
392
393       Also, the outputed network may not be connected if the value of betwee‐
394       ness_thresh is too large.
395

EXAMPLES

397   SIMPLIFICATION EXAMPLE
398       Simplification of county boundaries with DP method (North Carolina sam‐
399       ple dataset), threshold given in mapset units (here: meters):
400       v.generalize input=boundary_county output=boundary_county_dp20 \
401         method=douglas threshold=20 error=boundary_county_dp20_leftover
402       Figure:  Vector  simplification  example  (spatial subset: original map
403       shown in black, simplified map with 26%  remaining  vertices  shown  in
404       red)
405
406   SMOOTHING EXAMPLE
407       Smoothing  of  road  network with Chaiken method (North Carolina sample
408       dataset), threshold given in mapset units (here: meters):
409       v.generalize input=roads output=roads_chaiken method=chaiken \
410         threshold=1 error=roads_chaiken_leftover
411       Figure: Vector smoothing example (spatial subset: original map shown in
412       black,  smoothed  map  with  500% increased number of vertices shown in
413       red)
414

SEE ALSO

416        v.clean, v.dissolve
417
418       v.generalize Tutorial (GRASS-Wiki)
419

AUTHORS

421       Daniel Bundala, Google Summer of Code 2007, Student
422       Wolf Bergenheim, Mentor
423       Partial rewrite: Markus Metz
424
425       Last changed: $Date: 2017-05-07 22:50:11 +0200 (Sun, 07 May 2017) $
426

SOURCE CODE

428       Available at: v.generalize source code (history)
429
430       Main index | Vector index | Topics index | Keywords index  |  Graphical
431       index | Full index
432
433       © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
434
435
436
437GRASS 7.6.0                                                    v.generalize(1)
Impressum