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