# FreeBSD Manual Pages

v.generalize(1) GRASS GIS User's Manual v.generalize(1)NAMEv.generalize- Performs vector based generalization.KEYWORDSvector, generalization, simplification, smoothing, displacement, net- work generalization, topology, geometrySYNOPSISv.generalizev.generalize--helpv.generalize[-lt]input=name[layer=string] [type=string[,string,...]]output=name[error=name]method=stringthreshold=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:-lDisable loop support Do not modify end points of lines forming a closed loop-tDo not copy attributes--overwriteAllow output files to overwrite existing files--helpPrint usage summary--verboseVerbose module output--quietQuiet module output--uiForce launching GUI dialogParameters:input=nameA[required]Name of input vector map Or data source for direct OGR accesslayer=stringLayer 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:-1type=string[,string,...] Input feature type Options:line,boundary,areaDefault:line,boundary,areaoutput=nameA[required]Name for output vector maperror=nameError map with failed generalizations Lines and boundaries causing errors (collapsed to a point or topol- ogy errors)method=stringA[required]Generalization algorithm Options:douglas,douglas_reduction,lang,reduction,reumann,boyle,sliding_averaging,distance_weighting,chaiken,hermite,snakes,network,displacementdouglas: Douglas-Peucker Algorithmdouglas_reduction: Douglas-Peucker Algorithm with reduction parame- terlang: Lang Simplification Algorithmreduction: Vertex Reduction Algorithm eliminates points close to each otherreumann: Reumann-Witkam Algorithmboyle: Boyle's Forward-Looking Algorithmsliding_averaging: McMaster's Sliding Averaging Algorithmdistance_weighting: McMaster's Distance-Weighting Algorithmchaiken: Chaiken's Algorithmhermite: Interpolation by Cubic Hermite Splinessnakes: Snakes method for line smoothingnetwork: Network generalizationdisplacement: Displacement of lines close to each otherthreshold=floatA[required]Maximal tolerance value Options:0-1000000000look_ahead=integerLook-ahead parameter Default:7reduction=floatPercentage of the points in the output of 'douglas_reduction' algo- rithm Options:0-100Default:50slide=floatSlide of computed point toward the original point Options:0-1Default:0.5angle_thresh=floatMinimum angle between two consecutive segments in Hermite method Options:0-180Default:3degree_thresh=integerDegree threshold in network generalization Default:0closeness_thresh=floatCloseness threshold in network generalization Options:0-1Default:0betweeness_thresh=floatBetweeness threshold in network generalization Default:0alpha=floatSnakes alpha parameter Default:1.0beta=floatSnakes beta parameter Default:1.0iterations=integerNumber of iterations Default:1cats=rangeCategory values Example: 1,3,7-9,13where=sql_queryWHERE conditions of SQL statement without 'where' keyword Example: income < 1000 and population >= 10000DESCRIPTIONv.generalizeis 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). Thecatsandwhereoptions are used only if alayer> 0 is specified, otherwise, those options are ignored. Be aware that the default islayer=-1, meaning that all layers are processed, ignoring thecatsandwhereoptions. Iftype=areais selected, boundaries of selected areas will be general- ized, and the optionscats,where, andlayerwill be used to select ar- eas.NOTES(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 to- tal 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 smooth- ing. 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-lflag 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 writ- ten to an optionalerrorvector map. Overlaying theerrormap over the generalized map indicates the kind of error. Lines/boundaries collaps- ing to a point are written out as points, boundaries violating topology are written out as boundaries. Theerrormap can be overlaid over the generalized map to understand why some features were not generalized.SIMPLIFICATIONSimplification can fail for many boundaries if the simplification pa- rameters 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.generalizecontains following line simplification algorithms:oDouglas-Peucker AlgorithmoDouglas-Peucker Reduction AlgorithmoLang AlgorithmoVertex ReductionoReumann-Witkam Algorithm Different algorithms require different parameters, but all the algo- rithms have one parameter in common: thethresholdparameter, given in map units (for latitude-longitude locations: in decimal degree). In general, the degree of simplification increases with the increasing value ofthreshold.ALGORITHMDESCRIPTIONSoDouglas-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.oDouglas-PeuckerReductionAlgorithmis essentially the same al- gorithm as the algorithm above, the difference being that it takes an additionalreductionparameter which denotes the per- centage 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.oLang- Another standard algorithm. Input parameters:input,threshold,look_ahead. For an excellent description, see: http://www.sli.unimelb.edu.au/gisweb/LGmodule/LGLangVisualisa- tion.htm.oVertexReduction- Simplest among the algorithms. Input parame- ters:input,threshold. Given a line, this algorithm removes the points of this line which are closer to each other thanthreshold. More precisely, if p1 and p2 are two consecutive points, and the distance between p2 and p1 is less thanthresh-old, it removes p2 and repeats the same process on the remain- ing points.oReumann-Witkam- Input parameters:input,threshold. This al- gorithm quite reasonably preserves the global characteristics of the lines. For more information, see for example: http://psimpl.sourceforge.net/reumann-witkam.html.Douglas-PeuckerandDouglas-PeuckerReductionAlgorithmuse 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 thatdouglas_reductionnever outputs more vertices thandouglas, and that, in general,douglasis more efficient thandouglas_reduction. More im- portantly, 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'.SMOOTHINGThe following smoothing algorithms are implemented inv.generalize:oBoyle'sForward-LookingAlgorithm- The position of each point depends on the position of the previous points and the pointlook_aheadahead.look_aheadconsecutive points. Input parame- ters:input,look_ahead.oMcMaster'sSlidingAveragingAlgorithm- Input Parameters:in-put,slide,look_ahead. The new position of each point is the average of thelook_aheadpoints around. Parameterslideis used for linear interpolation between old and new position (see below).oMcMaster'sDistance-WeightingAlgorithm- Takes the weighted average oflook_aheadconsecutive points where the weight is the reciprocal of the distance from the point to the currently smoothed point. The parameterslideis used for linear interpo- lation between the original position of the point and newly computed position where value 0 means the original position. Input parameters:input,slide,look_ahead.oChaiken'sAlgorithm- "Inscribes" a line touching the original line such that the points on this new line are at leastthresh-oldapart. Input parameters:input,threshold. This algorithm approximates the given line very well.oHermiteInterpolation- This algorithm takes the points of the given line as the control points of hermite cubic spline and approximates this spline by the points approximatelythresholdapart. This method has excellent results for small values ofthreshold, but in this case it produces a huge number of new points and some simplification is usually needed. Input param- eters:input,threshold,angle_thresh.Angle_threshis used for reducing the number of the points. It denotes the minimal angle (in degrees) between two consecutive segments of a line.oSnakesis the method of minimisation of the "energy" of a line. This method preserves the general characteristics of the lines but smooths the "sharp corners" of a line. Input parametersin-put,alpha,beta. This algorithm works very well for small values ofalphaandbeta(between 0 and 5). These parameters affect the "sharpness" and the curvature of the computed line. One of the key advantages ofHermiteInterpolationis 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'sAlgorithmoutputs 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 itera- tions, the property above does not hold, but the computed lines are very similar to the Bezier Splines. The disadvantage of the two algo- rithms given above is that they increase the number of points. How- ever,HermiteInterpolationcan be used as another simplification algo- rithm. To achieve this, it is necessary to setangle_threshto higher values (15 or so). One restriction on both McMasters' Algorithms is thatlook_aheadparam- eter must be odd. Also note that these algorithms have no effect iflook_ahead=1. Note thatBoyle's,McMasters'andSnakesalgorithm 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.SnakesAlgorithm 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.DISPLACEMENTThe 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 inter- act and can be distinguished. This module implements an algorithm for displacement of linear features based on theSnakesapproach. This method generally yields very good results; however, it requires a lot of memory and is not very effi- cient. Displacement is selected bymethod=displacement. It uses the following parameters:othreshold- specifies critical distance. Two features interact if they are closer thanthresholdapart.oalpha,beta- These parameters define the rigidity of lines. For larger values ofalpha,beta(>=1), the algorithm does a better job at retaining the original shape of the lines, possi- bly at the expense of displacement distance. If the values ofalpha,betaare too small (<=0.001), then the lines are moved sufficiently, but the geometry and topology of lines can be de- stroyed. Most likely the best way to find the good values ofalpha,betais by trial and error.oiterations- denotes the number of iterations the interactions between the lines are resolved. Good starting points for values ofiterationsare between 10 and 100. The lines affected by the algorithm can be specified by thelayer,catsandwhereparameters.NETWORKGENERALIZATIONUsed 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 al- tered by the following parameters:odegree_thresh- algorithm selects only the lines which share a point with at leastdegree_threshdifferent lines.ocloseness_thresh- is always in the range (0, 1]. Only the lines with the closeness centrality value at leastclose-ness_threshapart 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.obetweeness_thresh- Again, only the lines with a betweeness centrality measure at leastbetweeness_threshare 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 be- tween other lines and lie on the paths between two parts of a network. In the terminology of road networks, these are high- ways, 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 outputed network may not be connected if the value ofbetwee-ness_threshis too large.EXAMPLESSIMPLIFICATIONEXAMPLESimplification of county boundaries with DP method (North Carolina sam- ple 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_leftoverFigure:Vectorsimplificationexample(spatialsubset:originalmapshowninblack,simplifiedmapwith26%remainingverticesshowninred)SMOOTHINGEXAMPLESmoothing 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_leftoverFigure:Vectorsmoothingexample(spatialsubset:originalmapshowninblack,smoothedmapwith500%increasednumberofverticesshowninred)SEE ALSOv.clean,v.dissolvev.generalize Tutorial (GRASS-Wiki)AUTHORSDaniel Bundala, Google Summer of Code 2007, Student Wolf Bergenheim, Mentor Partial rewrite: Markus MetzSOURCE CODEAvailable at: v.generalize source code (history) Main index | Vector index | Topics index | Keywords index | Graphical index | Full indexA(C) 2003-2020 GRASS Development Team, GRASS GIS 7.8.4 Reference Manual GRASS 7.8.4 v.generalize(1)

NAME | KEYWORDS | SYNOPSIS | DESCRIPTION | NOTES | EXAMPLES | SEE ALSO | AUTHORS | SOURCE CODE

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=v.generalize&sektion=1&manpath=FreeBSD+13.0-RELEASE+and+Ports>