v.generalize(1grass)

πŸ‘‘ v.generalize β€” straight from the GRASS User's Manual πŸ“–βœ¨

okay so bestie, welcome to v.generalize(1grass), literally one of my fave pages in the whole GRASS manual. she does vector based generalization and she eats every single time πŸ’…. we're gonna go through the whole thing together, no skipping, no cap.


🌸 NAME 🌸

v.generalize β€” Performs vector based generalization. that's the whole vibe, she takes your messy vector maps and makes them ✨aesthetic✨.


πŸŽ€ KEYWORDS πŸŽ€

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

(iykyk β€” if you know you know, and if you don't, you're about to πŸ¦‹)


✨ SYNOPSIS ✨

okay so here's how you actually call her, verbatim, don't @ me:

v.generalize
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]

🚩 Flags 🚩

the little switches, the toggles, the moment 🫢

  • -l β€” Disable loop support. Do not modify end points of lines forming a closed loop. she leaves your lil loops alone, periodt.
  • -t β€” Do not copy attributes. attributes stay home, bestie.
  • --overwrite β€” Allow output files to overwrite existing files. yes she will absolutely replace what's already there, be so for real about it πŸ’€
  • --help β€” Print usage summary. she tells you how to use her, iconic.
  • --verbose β€” Verbose module output. she talks more. love that for her.
  • --quiet β€” Quiet module output. she says nothing. mysterious. main character energy.
  • --ui β€” Force launching GUI dialog. pops the little window, very demure.

🌈 Parameters 🌈

okay THIS is the good part, all the knobs and dials:

  • input=name [required] β€” Name of input vector map. Or data source for direct OGR access. (yes you can feed her OGR directly, she's flexible like that 🧚)
  • layer=string β€” Layer number or name ('-1' for all layers). A single vector map can be connected to multiple database tables, so this number determines which table to use. When used with direct OGR access this is the layer name. Default: -1. (remember that -1, it matters later, no spoilers tho 😭)
  • type=string[,string,...] β€” Input feature type. Options: line, boundary, area. Default: line,boundary,area. she'll take all three unless you tell her otherwise.
  • output=name [required] β€” Name for output vector map. give her a name for the baby πŸŽ€
  • error=name β€” Error map with failed generalizations. Lines and boundaries causing errors (collapsed to a point or topology errors). it's giving "here's what went wrong, bestie". we'll get into it.
  • method=string [required] β€” Generalization algorithm. Options: douglas, douglas_reduction, lang, reduction, reumann, boyle, sliding_averaging, distance_weighting, chaiken, hermite, snakes, network, displacement. and here's what each one actually is, word for word:
    • 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. bestie that's a BIG range, use it responsibly.
  • look_ahead=integer β€” Look-ahead parameter. Default: 7.
  • reduction=float β€” Percentage of the points in the output of 'douglas_reduction' algorithm. Options: 0-100. Default: 50.
  • slide=float β€” Slide of computed point toward the original point. Options: 0-1. Default: 0.5.
  • angle_thresh=float β€” Minimum angle between two consecutive segments in Hermite method. Options: 0-180. Default: 3.
  • degree_thresh=integer β€” Degree threshold in network generalization. Default: 0.
  • closeness_thresh=float β€” Closeness threshold in network generalization. Options: 0-1. Default: 0.
  • betweeness_thresh=float β€” Betweeness threshold in network generalization. Default: 0.
  • alpha=float β€” Snakes alpha parameter. Default: 1.0.
  • beta=float β€” Snakes beta parameter. Default: 1.0.
  • iterations=integer β€” Number of iterations. Default: 1.
  • cats=range β€” Category values. Example: 1,3,7-9,13.
  • where=sql_query β€” WHERE conditions of SQL statement without 'where' keyword. Example: income < 1000 and population >= 10000.

πŸ’– DESCRIPTION πŸ’–

so. v.generalize is a module for the generalization of GRASS vector maps, and honestly? she's got range. she comes with algorithms for line simplification, line smoothing, network generalization and displacement. also the manual says new methods may be added later, so she's always growing, we love a glow-up arc 🌱

about the cats and where options β€” okay so LISTEN, bestie, because this is the part people get wrong: those options are used only if a layer > 0 is specified. otherwise, they're just ignored. completely. don't even look at them. and be aware that the default is layer=-1, which means all layers are processed and the cats and where options get straight-up ignored. no cap. it's giving "why isn't my filter working" and the answer is always the default -1 😭

and if type=area is selected? then boundaries of selected areas will be generalized, and the options cats, where, and layer are the ones used to select which areas. different selection game entirely. okay?


πŸ¦‹ NOTES πŸ¦‹

okay so let's talk theory, but make it cute.

(Line) simplification is a process of reducing the complexity of vector features. she transforms a line into another line that has fewer vertices, but it still approximates the original line. most of the algorithms down below just select a subset of points on the original line β€” like, "you, you, and you, you're coming with me, the rest of you stay home" πŸ’…

(Line) smoothing is a "reverse" process β€” she takes a line as input and produces a smoother approximate of the original. in some cases this is achieved by inserting new vertices into the original line, and bestie, the vertex count can total up to 4000% of the number of vertices in the original. 😭 FOUR THOUSAND PERCENT. so in that instance, it is always a good idea to simplify the line after smoothing. write that down. simplify. after. smoothing.

the smoothing and simplification algorithms in this module work line by line, i.e. simplification/smoothing of one line does not affect the other lines, they are treated separately. each line minds its own business, respecting boundaries, as she should 🫢

for isolated loops formed by a single line/boundary, the 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. (-l said "not on my watch" βœ‹)

and now the rules, pay attention because these are the dramatic ones:

  • 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 get written to an optional error vector map. overlaying the error map over the generalized map indicates the kind of error. specifically: lines/boundaries collapsing to a point are written out as points, and boundaries violating topology are written out as boundaries. then you can overlay the error map over the generalized map to understand why some features were not generalized. it's giving detective work πŸ”


πŸ”₯ SIMPLIFICATION πŸ”₯

simplification can fail for many boundaries if the simplification parameters would result in a large reduction of vertices. so if many lines/boundaries could not be simplified, try different parameters that would cause a lower degree of simplification. less aggressive, more chill, more results 🌸

v.generalize contains the following line simplification algorithms, and here's the whole list, no cuts:

  • Douglas-Peucker Algorithm
  • Douglas-Peucker Reduction Algorithm
  • Lang Algorithm
  • Vertex Reduction
  • Reumann-Witkam Algorithm

different algorithms require different parameters, but all the algorithms have one parameter in common: the threshold parameter, given in map units (for latitude-longitude projects: in decimal degree). and in general, the degree of simplification increases with the increasing value of threshold. bigger number, more she removes, periodt.


🌈 ALGORITHM DESCRIPTIONS 🌈

the deep dive, the lore, the backstory of each algorithm:

  • Douglas-Peucker β€” "Quicksort" of line simplification, the most widely used algorithm. Input parameters: input, threshold. For more information, see: http://geomalgorithms.com/a16-_decimate-1.html. she's the moment, the icon, the legend πŸ‘‘
  • Douglas-Peucker Reduction Algorithm β€” essentially the same algorithm as the algorithm above, the difference being that it takes an additional reduction parameter which denotes the percentage of the number of points on the new line with respect to the number of points on the original line. Input parameters: input, threshold, reduction. same girl, extra knob.
  • Lang β€” Another standard algorithm. Input parameters: input, threshold, look_ahead. For an excellent description, see: http://www.sli.unimelb.edu.au/gisweb/LGmodule/LGLangVisualisation.htm.
  • Vertex Reduction β€” Simplest among the algorithms. Input parameters: input, threshold. Given a line, this algorithm removes the points of this line which are closer to each other than threshold. More precisely, if p1 and p2 are two consecutive points, and the distance between p2 and p1 is less than threshold, it removes p2 and repeats the same process on the remaining points. honestly so straightforward it's kind of iconic ✨
  • Reumann-Witkam β€” Input parameters: input, threshold. This algorithm quite reasonably preserves the global characteristics of the lines. For more information, see for example: http://psimpl.sourceforge.net/reumann-witkam.html. "quite reasonably" is the most polite thing anyone's ever written in a manual, fr fr.

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. (she said what she said.)

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'. three cheers for the reduction, bestie πŸŽ‰


🌸 SMOOTHING 🌸

the following smoothing algorithms are implemented in v.generalize, and yes, we're doing all of them:

  • Boyle's Forward-Looking Algorithm β€” The position of each point depends on the position of the previous points and the point look_ahead ahead. look_ahead consecutive points. Input parameters: input, look_ahead. (yes, the manual literally says it twice like that. she's looking ahead, and also, she's looking ahead. πŸ’€)
  • McMaster's Sliding Averaging Algorithm β€” Input Parameters: input, slide, look_ahead. The new position of each point is the average of the look_ahead points around. Parameter slide is used for linear interpolation between old and new position (see below). it's giving math, but make it smooth 🧚
  • McMaster's Distance-Weighting Algorithm β€” Takes the weighted average of look_ahead consecutive points where the weight is the reciprocal of the distance from the point to the currently smoothed point. The parameter slide is used for linear interpolation between the original position of the point and newly computed position where value 0 means the original position. Input parameters: input, slide, look_ahead.
  • Chaiken's Algorithm β€” it "inscribes" a line that touches the original line, so that the points on this new line are at least threshold apart. Input parameters: input, threshold. Bestie, this one approximates the given line very well. πŸ’…
  • Hermite Interpolation β€” this one takes the points of the given line as the control points of a hermite cubic spline, then approximates that spline with points that are approximately threshold apart. It has excellent results for small values of threshold, but in that case it produces a HUGE number of new points, so some simplification is usually needed. Input parameters: input, threshold, angle_thresh. The angle_thresh is what reduces the number of points β€” it's the minimal angle (in degrees) between two consecutive segments of a line. πŸ¦‹
  • Snakes β€” the method of minimisation of the "energy" of a line. It preserves the general characteristics of the lines but smooths out those "sharp corners". Input parameters input, alpha, beta. This algorithm is lowkey iconic for small values of alpha and beta (between 0 and 5). Those parameters affect the "sharpness" and the curvature of the computed line. 🐍

One of the key advantages of Hermite Interpolation? 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, that property above does not hold, but the computed lines are very similar to the Bezier Splines. The disadvantage of the two algorithms above? They increase the number of points. Not great, honestly. 😭

However β€” plot twist β€” 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: the 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 algorithms are sometimes used in 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. Periodt.

Snakes Algorithm is (asymptotically) the slowest among the algorithms presented above. It also requires quite a lot of memory. Which means it's not very efficient for maps with lines consisting of many segments. πŸ’€


🫢 DISPLACEMENT 🫢

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. fair warning bestie

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

  • threshold β€” specifies critical distance. Two features interact if they are closer than threshold apart.
  • alpha, beta β€” these parameters define the rigidity of lines. For larger values of alpha, beta (>=1), the algorithm does a better job at retaining the original shape of the lines, possibly at the expense of displacement distance. If the values of alpha, beta are too small (<=0.001), then the lines are moved sufficiently, but the geometry and topology of lines can be destroyed. 😱 Most likely the best way to find the good values of alpha, beta is by trial and error.
  • iterations β€” denotes the number of iterations the interactions between the lines are resolved. Good starting points for values of iterations are between 10 and 100.

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


🌈 NETWORK GENERALIZATION 🌈

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 the algorithm can be altered by the following parameters:

  • degree_thresh β€” algorithm selects only the lines which share a point with at least degree_thresh different lines.
  • closeness_thresh β€” is always in the range (0, 1]. Only the lines with the closeness centrality value at least closeness_thresh apart are selected. The lines in the centre of a network have greater values of this measure than the lines near the border of a network. This means that this parameter can be used for selecting the centre(s) of a network. Note that if closeness_thresh=0 then everything is selected. πŸ’–
  • betweeness_thresh β€” again, only the lines with a betweeness centrality measure at least betweeness_thresh are selected. This value is always positive and is larger for large networks. It denotes to what extent a line is in between the other lines in the network. This value is large for the lines which lie between other lines and lie on the paths between two parts of a network. In the terminology of road networks, these are highways, bypasses, main roads/streets, etc. πŸ”₯

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. heads up!!


✨ EXAMPLES ✨

πŸ’œ SIMPLIFICATION EXAMPLE πŸ’œ

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

Figure: Vector simplification example (spatial subset: original map shown in black, simplified map with 26% remaining vertices shown in red) 🎨

🌸 SMOOTHING EXAMPLE 🌸

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

Figure: Vector smoothing example (spatial subset: original map shown in black, smoothed map with 500% increased number of vertices shown in red) 🎨


πŸ‘€ SEE ALSO πŸ‘€

  • v.clean
  • v.dissolve

v.generalize Tutorial (GRASS-Wiki) β€” go read it bestie, it's giving educational. πŸ“š


πŸ‘‘ AUTHORS πŸ‘‘

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

πŸ’» SOURCE CODE πŸ’»

Available at: v.generalize source code (history)

Latest change: Monday Nov 03 07:06:22 2025 in commit: 072a1ce62e0d4ac0444c685586c2d9bc210226b4

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


aaand that's a wrap 🎬 this whole thing is Β© 2003-2026 GRASS Development Team, straight out of the GRASS 8.5.0 Reference Manual β€” last touched Monday Nov 03 07:06:22 2025, and yeah, she's serving v.generalize(1grass). slay, go generalize something πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from