v.generalize.1 18.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
.TH v.generalize 1 "" "GRASS 7.8.5" "GRASS GIS User's Manual"
.SH NAME
\fI\fBv.generalize\fR\fR  \- Performs vector based generalization.
.SH KEYWORDS
vector, generalization, simplification, smoothing, displacement, network generalization, topology, geometry
.SH SYNOPSIS
\fBv.generalize\fR
.br
\fBv.generalize \-\-help\fR
.br
\fBv.generalize\fR [\-\fBlt\fR] \fBinput\fR=\fIname\fR  [\fBlayer\fR=\fIstring\fR]   [\fBtype\fR=\fIstring\fR[,\fIstring\fR,...]]  \fBoutput\fR=\fIname\fR  [\fBerror\fR=\fIname\fR]  \fBmethod\fR=\fIstring\fR \fBthreshold\fR=\fIfloat\fR  [\fBlook_ahead\fR=\fIinteger\fR]   [\fBreduction\fR=\fIfloat\fR]   [\fBslide\fR=\fIfloat\fR]   [\fBangle_thresh\fR=\fIfloat\fR]   [\fBdegree_thresh\fR=\fIinteger\fR]   [\fBcloseness_thresh\fR=\fIfloat\fR]   [\fBbetweeness_thresh\fR=\fIfloat\fR]   [\fBalpha\fR=\fIfloat\fR]   [\fBbeta\fR=\fIfloat\fR]   [\fBiterations\fR=\fIinteger\fR]   [\fBcats\fR=\fIrange\fR]   [\fBwhere\fR=\fIsql_query\fR]   [\-\-\fBoverwrite\fR]  [\-\-\fBhelp\fR]  [\-\-\fBverbose\fR]  [\-\-\fBquiet\fR]  [\-\-\fBui\fR]
.SS Flags:
.IP "\fB\-l\fR" 4m
.br
Disable loop support
.br
Do not modify end points of lines forming a closed loop
.IP "\fB\-t\fR" 4m
.br
Do not copy attributes
.IP "\fB\-\-overwrite\fR" 4m
.br
Allow output files to overwrite existing files
.IP "\fB\-\-help\fR" 4m
.br
Print usage summary
.IP "\fB\-\-verbose\fR" 4m
.br
Verbose module output
.IP "\fB\-\-quiet\fR" 4m
.br
Quiet module output
.IP "\fB\-\-ui\fR" 4m
.br
Force launching GUI dialog
.SS Parameters:
.IP "\fBinput\fR=\fIname\fR \fB[required]\fR" 4m
.br
Name of input vector map
.br
Or data source for direct OGR access
.IP "\fBlayer\fR=\fIstring\fR" 4m
.br
Layer number or name (\(cq\-1\(cq for all layers)
.br
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.
.br
Default: \fI\-1\fR
.IP "\fBtype\fR=\fIstring[,\fIstring\fR,...]\fR" 4m
.br
Input feature type
.br
Options: \fIline, boundary, area\fR
.br
Default: \fIline,boundary,area\fR
.IP "\fBoutput\fR=\fIname\fR \fB[required]\fR" 4m
.br
Name for output vector map
.IP "\fBerror\fR=\fIname\fR" 4m
.br
Error map with failed generalizations
.br
Lines and boundaries causing errors (collapsed to a point or topology errors)
.IP "\fBmethod\fR=\fIstring\fR \fB[required]\fR" 4m
.br
Generalization algorithm
.br
Options: \fIdouglas, douglas_reduction, lang, reduction, reumann, boyle, sliding_averaging, distance_weighting, chaiken, hermite, snakes, network, displacement\fR
.br
\fBdouglas\fR: Douglas\-Peucker Algorithm
.br
\fBdouglas_reduction\fR: Douglas\-Peucker Algorithm with reduction parameter
.br
\fBlang\fR: Lang Simplification Algorithm
.br
\fBreduction\fR: Vertex Reduction Algorithm eliminates points close to each other
.br
\fBreumann\fR: Reumann\-Witkam Algorithm
.br
\fBboyle\fR: Boyle\(cqs Forward\-Looking Algorithm
.br
\fBsliding_averaging\fR: McMaster\(cqs Sliding Averaging Algorithm
.br
\fBdistance_weighting\fR: McMaster\(cqs Distance\-Weighting Algorithm
.br
\fBchaiken\fR: Chaiken\(cqs Algorithm
.br
\fBhermite\fR: Interpolation by Cubic Hermite Splines
.br
\fBsnakes\fR: Snakes method for line smoothing
.br
\fBnetwork\fR: Network generalization
.br
\fBdisplacement\fR: Displacement of lines close to each other
.IP "\fBthreshold\fR=\fIfloat\fR \fB[required]\fR" 4m
.br
Maximal tolerance value
.br
Options: \fI0\-1000000000\fR
.IP "\fBlook_ahead\fR=\fIinteger\fR" 4m
.br
Look\-ahead parameter
.br
Default: \fI7\fR
.IP "\fBreduction\fR=\fIfloat\fR" 4m
.br
Percentage of the points in the output of \(cqdouglas_reduction\(cq algorithm
.br
Options: \fI0\-100\fR
.br
Default: \fI50\fR
.IP "\fBslide\fR=\fIfloat\fR" 4m
.br
Slide of computed point toward the original point
.br
Options: \fI0\-1\fR
.br
Default: \fI0.5\fR
.IP "\fBangle_thresh\fR=\fIfloat\fR" 4m
.br
Minimum angle between two consecutive segments in Hermite method
.br
Options: \fI0\-180\fR
.br
Default: \fI3\fR
.IP "\fBdegree_thresh\fR=\fIinteger\fR" 4m
.br
Degree threshold in network generalization
.br
Default: \fI0\fR
.IP "\fBcloseness_thresh\fR=\fIfloat\fR" 4m
.br
Closeness threshold in network generalization
.br
Options: \fI0\-1\fR
.br
Default: \fI0\fR
.IP "\fBbetweeness_thresh\fR=\fIfloat\fR" 4m
.br
Betweeness threshold in network generalization
.br
Default: \fI0\fR
.IP "\fBalpha\fR=\fIfloat\fR" 4m
.br
Snakes alpha parameter
.br
Default: \fI1.0\fR
.IP "\fBbeta\fR=\fIfloat\fR" 4m
.br
Snakes beta parameter
.br
Default: \fI1.0\fR
.IP "\fBiterations\fR=\fIinteger\fR" 4m
.br
Number of iterations
.br
Default: \fI1\fR
.IP "\fBcats\fR=\fIrange\fR" 4m
.br
Category values
.br
Example: 1,3,7\-9,13
.IP "\fBwhere\fR=\fIsql_query\fR" 4m
.br
WHERE conditions of SQL statement without \(cqwhere\(cq keyword
.br
Example: income < 1000 and population >= 10000
.SH DESCRIPTION
\fIv.generalize\fR 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).
.PP
The \fBcats\fR and \fBwhere\fR options are used only if a \fBlayer\fR
> 0 is specified, otherwise, those options are ignored. Be aware
that the default is \fIlayer=\-1\fR, meaning that all layers are
processed, ignoring the \fBcats\fR and \fBwhere\fR options.
.PP
If \fBtype=area\fR is selected, boundaries of selected areas will be
generalized, and the options \fBcats\fR, \fBwhere\fR, and
\fBlayer\fR will be used to select areas.
.SH 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.
.PP
(Line) smoothing is a \(dqreverse\(dq 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.
.PP
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 \fI\-l\fR
flag is used to disable loop support.
.PP
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 \fIerror\fR vector map. Overlaying the \fIerror\fR
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
\fIerror\fR map can be overlaid over the generalized map to
understand why some features were not generalized.
.SS SIMPLIFICATION
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.
.PP
\fIv.generalize\fR contains following line simplification algorithms:
.RS 4n
.IP \(bu 4n
Douglas\-Peucker Algorithm
.IP \(bu 4n
Douglas\-Peucker Reduction Algorithm
.IP \(bu 4n
Lang Algorithm
.IP \(bu 4n
Vertex Reduction
.IP \(bu 4n
Reumann\-Witkam Algorithm
.RE
Different algorithms require different parameters, but all the algorithms
have one parameter in common: the \fBthreshold\fR parameter, given in map
units (for latitude\-longitude locations: in decimal degree). In general,
the degree of simplification increases with the increasing value of
\fBthreshold\fR.
.SS ALGORITHM DESCRIPTIONS
.RS 4n
.IP \(bu 4n
\fIDouglas\-Peucker\fR \- \(dqQuicksort\(dq of line simplification, the
most widely used algorithm. Input parameters: \fBinput\fR,
\fBthreshold\fR. For more information, see:
.br
http://geomalgorithms.com/a16\-_decimate\-1.html.
.IP \(bu 4n
\fIDouglas\-Peucker Reduction Algorithm\fR is essentially the same
algorithm as the algorithm above, the difference being that it takes
an additional \fBreduction\fR 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: \fBinput\fR,
\fBthreshold\fR, \fBreduction\fR.
.IP \(bu 4n
\fILang\fR \- Another standard algorithm. Input parameters:
\fBinput\fR, \fBthreshold\fR, \fBlook_ahead\fR.
For an excellent description, see:
.br
http://www.sli.unimelb.edu.au/gisweb/LGmodule/LGLangVisualisation.htm.
.IP \(bu 4n
\fIVertex Reduction\fR \- Simplest among the algorithms. Input
parameters: \fBinput\fR, \fBthreshold\fR.
Given a line, this algorithm removes the points of this line which
are closer to each other than \fBthreshold\fR. More precisely, if
p1 and p2 are two consecutive points, and the distance between p2
and p1 is less than \fBthreshold\fR, it removes p2 and repeats the
same process on the remaining points.
.IP \(bu 4n
\fIReumann\-Witkam\fR \- Input parameters: \fBinput\fR,
\fBthreshold\fR.
This algorithm quite reasonably preserves the global characteristics
of the lines. For more information, see for example:
.br
http://psimpl.sourceforge.net/reumann\-witkam.html.
.RE
\fIDouglas\-Peucker\fR and \fIDouglas\-Peucker Reduction Algorithm\fR
use the same method to simplify the lines. Note that
.br
.nf
\fC
v.generalize input=boundary_county output=boundary_county_dp20 method=douglas threshold=20
\fR
.fi
is equivalent to
.br
.nf
\fC
v.generalize input=boundary_county output=boundary_county_dp_red20_100 \(rs
             method=douglas_reduction threshold=20 reduction=100
\fR
.fi
However, in this case, the first method is faster. Also observe that
\fIdouglas_reduction\fR never outputs more vertices than \fIdouglas\fR,
and that, in general, \fIdouglas\fR is more efficient than
\fIdouglas_reduction\fR. More importantly, the effect of
.br
.nf
\fC
v.generalize input=boundary_county output=boundary_county_dp_red0_30 \(rs
             method=douglas_reduction threshold=0 reduction=30
\fR
.fi
is that \(cqout\(cq contains approximately only 30% of points of \(cqin\(cq.
.SS SMOOTHING
The following smoothing algorithms are implemented in \fIv.generalize\fR:
.RS 4n
.IP \(bu 4n
\fIBoyle\(cqs Forward\-Looking Algorithm\fR \- The position of each point
depends on the position of the previous points and the point
\fBlook_ahead\fR ahead. \fBlook_ahead\fR consecutive points. Input
parameters: \fBinput\fR, \fBlook_ahead\fR.
.IP \(bu 4n
\fIMcMaster\(cqs Sliding Averaging Algorithm\fR \- Input Parameters:
\fBinput\fR, \fBslide\fR, \fBlook_ahead\fR.
The new position of each point is the average of the \fBlook_ahead\fR
points around. Parameter \fBslide\fR is used for linear interpolation
between old and new position (see below).
.IP \(bu 4n
\fIMcMaster\(cqs Distance\-Weighting Algorithm\fR \- Takes the weighted
average of \fBlook_ahead\fR consecutive points where the weight is
the reciprocal of the distance from the point to the currently
smoothed point. The parameter \fBslide\fR 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: \fBinput\fR, \fBslide\fR, \fBlook_ahead\fR.
.IP \(bu 4n
\fIChaiken\(cqs Algorithm\fR \- \(dqInscribes\(dq a line touching the original
line such that the points on this new line are at least
\fIthreshold\fR apart. Input parameters: \fBinput\fR,
\fBthreshold\fR. This algorithm approximates the given line very
well.
.IP \(bu 4n
\fIHermite Interpolation\fR \- This algorithm takes the points of
the given line as the control points of hermite cubic spline and
approximates this spline by the points approximately
\fBthreshold\fR apart. This method has excellent results for small
values of \fBthreshold\fR, but in this case it produces a huge
number of new points and some simplification is usually needed.
Input parameters: \fBinput\fR, \fBthreshold\fR, \fBangle_thresh\fR.
\fBAngle_thresh\fR is used for reducing the number of the points.
It denotes the minimal angle (in degrees) between two consecutive
segments of a line.
.IP \(bu 4n
\fISnakes\fR is the method of minimisation of the \(dqenergy\(dq of a
line. This method preserves the general characteristics of the lines
but smooths the \(dqsharp corners\(dq of a line. Input parameters
\fBinput\fR, \fBalpha\fR, \fBbeta\fR.
This algorithm works very well for small values of \fBalpha\fR and
\fBbeta\fR (between 0 and 5). These parameters affect the
\(dqsharpness\(dq and the curvature of the computed line.
.RE
One of the key advantages of \fIHermite Interpolation\fR 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
\(dqcircumscribes\(dq the input line.
.PP
On the other hand, \fIChaiken\(cqs Algorithm\fR outputs a line which
\(dqinscribes\(dq 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, \fIHermite Interpolation\fR can be used as another
simplification algorithm. To achieve this, it is necessary to set
\fIangle_thresh\fR to higher values (15 or so).
.PP
One restriction on both McMasters\(cq Algorithms is that \fIlook_ahead\fR
parameter must be odd. Also note that these algorithms have no effect if
\fIlook_ahead = 1\fR.
.PP
Note that \fIBoyle\(cqs\fR, \fIMcMasters\(cq\fR and \fISnakes\fR 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.
.PP
\fISnakes\fR 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.
.SS 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.
.PP
This module implements an algorithm for displacement of linear features
based on the \fISnakes\fR approach. This method generally yields very
good results; however, it requires a lot of memory and is not very efficient.
.PP
Displacement is selected by \fBmethod=displacement\fR. It uses the
following parameters:
.RS 4n
.IP \(bu 4n
\fBthreshold\fR \- specifies critical distance. Two features interact if
they are closer than \fBthreshold\fR apart.
.IP \(bu 4n
\fBalpha\fR, \fBbeta\fR \- These parameters define the rigidity of lines.
For larger values of \fBalpha\fR, \fBbeta\fR (>=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 \fBalpha\fR,
\fBbeta\fR 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 \fBalpha\fR, \fBbeta\fR
is by trial and error.
.IP \(bu 4n
\fBiterations\fR \- denotes the number of iterations the interactions
between the lines are resolved. Good starting points for values of
\fBiterations\fR are between 10 and 100.
.RE
The lines affected by the algorithm can be specified by the \fBlayer\fR,
\fBcats\fR and \fBwhere\fR parameters.
.SS NETWORK GENERALIZATION
Used for selecting \(dqthe most important\(dq 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:
.RS 4n
.IP \(bu 4n
\fBdegree_thresh\fR \- algorithm selects only the lines which share a point
with at least \fBdegree_thresh\fR different lines.
.IP \(bu 4n
\fBcloseness_thresh\fR \- is always in the range (0, 1]. Only the lines
with the closeness centrality value at least \fBcloseness_thresh\fR 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.
.IP \(bu 4n
\fBbetweeness_thresh\fR \- Again, only the lines with a betweeness
centrality measure at least \fBbetweeness_thresh\fR 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.
.RE
All three parameters above can be presented at the same time. In that
case, the algorithm selects only the lines which meet each criterion.
.PP
Also, the outputed network may not be connected if the value of
\fBbetweeness_thresh\fR is too large.
.SH EXAMPLES
.SS SIMPLIFICATION EXAMPLE
Simplification of county boundaries with DP method (North Carolina sample dataset),
threshold given in mapset units (here: meters):
.br
.nf
\fC
v.generalize input=boundary_county output=boundary_county_dp20 \(rs
  method=douglas threshold=20 error=boundary_county_dp20_leftover
\fR
.fi
.br
\fIFigure: Vector simplification example (spatial subset:
original map shown in black, simplified map with 26% remaining vertices shown in red)\fR
.SS SMOOTHING EXAMPLE
Smoothing of road network with Chaiken method (North Carolina sample dataset),
threshold given in mapset units (here: meters):
.br
.nf
\fC
v.generalize input=roads output=roads_chaiken method=chaiken \(rs
  threshold=1 error=roads_chaiken_leftover
\fR
.fi
.br
\fIFigure: Vector smoothing example (spatial subset:
original map shown in black, smoothed map with 500% increased number of vertices shown in red)\fR
.SH SEE ALSO
\fI
v.clean,
v.dissolve
\fR
.PP
v.generalize Tutorial (GRASS\-Wiki)
.SH AUTHORS
Daniel Bundala, Google Summer of Code 2007, Student
.br
Wolf Bergenheim, Mentor
.br
Partial rewrite: Markus Metz
.SH SOURCE CODE
.PP
Available at: v.generalize source code (history)
.PP
Main index |
Vector index |
Topics index |
Keywords index |
Graphical index |
Full index
.PP
© 2003\-2020
GRASS Development Team,
GRASS GIS 7.8.5 Reference Manual