GRASS logo


v.generalize - Performs vector based generalization.


vector, generalization, simplification, smoothing, displacement, network generalization, topology, geometry


v.generalize --help
v.generalize [-lt] input=name [layer=string] [type=string[,string,...]] output=name [error=name] method=string threshold=float [look_ahead=integer] [reduction=float] [slide=float] [angle_thresh=float] [degree_thresh=integer] [closeness_thresh=float] [betweeness_thresh=float] [alpha=float] [beta=float] [iterations=integer] [cats=range] [where=sql_query] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Disable loop support
Do not modify end points of lines forming a closed loop
Do not copy attributes
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


input=name [required]
Name of input vector map
Or data source for direct OGR access
Layer number or name ('-1' for all layers)
A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
Default: -1
Input feature type
Options: line, boundary, area
Default: line,boundary,area
output=name [required]
Name for output vector map
Error map with failed generalizations
Lines and boundaries causing errors (collapsed to a point or topology errors)
method=string [required]
Generalization algorithm
Options: douglas, douglas_reduction, lang, reduction, reumann, boyle, sliding_averaging, distance_weighting, chaiken, hermite, snakes, network, displacement
douglas: Douglas-Peucker Algorithm
douglas_reduction: Douglas-Peucker Algorithm with reduction parameter
lang: Lang Simplification Algorithm
reduction: Vertex Reduction Algorithm eliminates points close to each other
reumann: Reumann-Witkam Algorithm
boyle: Boyle's Forward-Looking Algorithm
sliding_averaging: McMaster's Sliding Averaging Algorithm
distance_weighting: McMaster's Distance-Weighting Algorithm
chaiken: Chaiken's Algorithm
hermite: Interpolation by Cubic Hermite Splines
snakes: Snakes method for line smoothing
network: Network generalization
displacement: Displacement of lines close to each other
threshold=float [required]
Maximal tolerance value
Options: 0-1000000000
Look-ahead parameter
Default: 7
Percentage of the points in the output of 'douglas_reduction' algorithm
Options: 0-100
Default: 50
Slide of computed point toward the original point
Options: 0-1
Default: 0.5
Minimum angle between two consecutive segments in Hermite method
Options: 0-180
Default: 3
Degree threshold in network generalization
Default: 0
Closeness threshold in network generalization
Options: 0-1
Default: 0
Betweeness threshold in network generalization
Default: 0
Snakes alpha parameter
Default: 1.0
Snakes beta parameter
Default: 1.0
Number of iterations
Default: 1
Category values
Example: 1,3,7-9,13
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and population >= 10000

Table of contents


v.generalize is a module for the generalization of GRASS vector maps. This module consists of algorithms for line simplification, line smoothing, network generalization and displacement (new methods may be added later).

The cats and where options are used only if a layer > 0 is specified, otherwise, those options are ignored. Be aware that the default is layer=-1, meaning that all layers are processed, ignoring the cats and where options.

If type=area is selected, boundaries of selected areas will be generalized, and the options cats, where, and layer will be used to select areas.


(Line) simplification is a process of reducing the complexity of vector features. The module transforms a line into another line consisting of fewer vertices, that still approximate the original line. Most of the algorithms described below select a subset of points on the original line.

(Line) smoothing is a "reverse" process which takes as input a line and produces a smoother approximate of the original. In some cases, this is achieved by inserting new vertices into the original line, and can total up to 4000% of the number of vertices in the original. In such an instance, it is always a good idea to simplify the line after smoothing.

Smoothing and simplification algorithms implemented in this module work line by line, i.e. simplification/smoothing of one line does not affect the other lines; they are treated separately. For isolated loops formed by a single line/boundary, he first and the last point of each line/boundary can be translated and/or deleted, unless the -l flag is used to disable loop support.

Lines and boundaries are not translated if they would collapse to a single point. Boundaries are not translated if they would intersect with themselves or other boundaries. Such erroneous features are written to an optional error vector map. Overlaying the error map over the generalized map indicates the kind of error. Lines/boundaries collapsing to a point are written out as points, boundaries violating topology are written out as boundaries. The error map can be overlaid over the generalized map to understand why some features were not generalized.


Simplification can fail for many boundaries if the simplification parameters would result in a large reduction of vertices. If many lines/boundaries could not be simplified, try different parameters that would cause a lower degree of simplification.

v.generalize contains following line simplification algorithms:

Different algorithms require different parameters, but all the algorithms have one parameter in common: the threshold parameter, given in map units (for latitude-longitude locations: in decimal degree). In general, the degree of simplification increases with the increasing value of threshold.


Douglas-Peucker and Douglas-Peucker Reduction Algorithm use the same method to simplify the lines. Note that
v.generalize input=boundary_county output=boundary_county_dp20 method=douglas threshold=20
is equivalent to
v.generalize input=boundary_county output=boundary_county_dp_red20_100 \
             method=douglas_reduction threshold=20 reduction=100
However, in this case, the first method is faster. Also observe that douglas_reduction never outputs more vertices than douglas, and that, in general, douglas is more efficient than douglas_reduction. More importantly, the effect of
v.generalize input=boundary_county output=boundary_county_dp_red0_30 \
             method=douglas_reduction threshold=0 reduction=30
is that 'out' contains approximately only 30% of points of 'in'.


The following smoothing algorithms are implemented in v.generalize: One of the key advantages of Hermite Interpolation is the fact that the computed line always passes through the points of the original line, whereas the lines produced by the remaining algorithms never pass through these points. In some sense, this algorithm outputs a line which "circumscribes" the input line.

On the other hand, Chaiken's Algorithm outputs a line which "inscribes" a given line. The output line always touches/intersects the centre of the input line segment between two consecutive points. For more iterations, the property above does not hold, but the computed lines are very similar to the Bezier Splines. The disadvantage of the two algorithms given above is that they increase the number of points. However, Hermite Interpolation can be used as another simplification algorithm. To achieve this, it is necessary to set angle_thresh to higher values (15 or so).

One restriction on both McMasters' Algorithms is that look_ahead parameter must be odd. Also note that these algorithms have no effect if look_ahead = 1.

Note that Boyle's, McMasters' and Snakes algorithm are sometimes used in the signal processing to smooth the signals. More importantly, these algorithms never change the number of points on the lines; they only translate the points, and do not insert any new points.

Snakes Algorithm is (asymptotically) the slowest among the algorithms presented above. Also, it requires quite a lot of memory. This means that it is not very efficient for maps with the lines consisting of many segments.


The displacement is used when the lines overlap and/or are close to each other at the current level of detail. In general, displacement methods move the conflicting features apart so that they do not interact and can be distinguished.

This module implements an algorithm for displacement of linear features based on the Snakes approach. This method generally yields very good results; however, it requires a lot of memory and is not very efficient.

Displacement is selected by method=displacement. It uses the following parameters:

The lines affected by the algorithm can be specified by the layer, cats and where parameters.


Used for selecting "the most important" part of the network. This is based on the graph algorithms. Network generalization is applied if method=network. The algorithm calculates three centrality measures for each line in the network and only the lines with the values greater than thresholds are selected. The behaviour of algorithm can be altered by the following parameters: All three parameters above can be presented at the same time. In that case, the algorithm selects only the lines which meet each criterion.

Also, the outputted network may not be connected if the value of betweeness_thresh is too large.



Simplification of county boundaries with DP method (North Carolina sample dataset), threshold given in mapset units (here: meters):
v.generalize input=boundary_county output=boundary_county_dp20 \
  method=douglas threshold=20 error=boundary_county_dp20_leftover
v.generalize simplification example
Figure: Vector simplification example (spatial subset: original map shown in black, simplified map with 26% remaining vertices shown in red)


Smoothing of road network with Chaiken method (North Carolina sample dataset), threshold given in mapset units (here: meters):
v.generalize input=roads output=roads_chaiken method=chaiken \
  threshold=1 error=roads_chaiken_leftover
v.generalize smoothing example
Figure: Vector smoothing example (spatial subset: original map shown in black, smoothed map with 500% increased number of vertices shown in red)


v.clean, v.dissolve

v.generalize Tutorial (GRASS-Wiki)


Daniel Bundala, Google Summer of Code 2007, Student
Wolf Bergenheim, Mentor
Partial rewrite: Markus Metz


Available at: v.generalize source code (history)

Latest change: Monday Feb 27 13:45:25 2023 in commit: a82501dc85294207e8e58437c3ec7f1056465ed4

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual