File: v.decimate.html

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (141 lines) | stat: -rw-r--r-- 4,585 bytes parent folder | download | duplicates (2)
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
<h2>DESCRIPTION</h2>

<em>v.decimate</em> reduces number of points in the input vector map
and copies them over to the output vector map. Different point decimation
techniques can be applied to reduce the number of points.

<p>
Two main decimation techniques are:
<ul>
<li>count-based decimation (<b>skip</b>, <b>preserve</b>, <b>offset</b>
    and <b>limit</b> options)</li>
<li>grid-based decimation (<b>-g</b> flag)</li>
</ul>

<p>
The grid-based decimation will remove points based on:
<ul>
<li>similar z coordinates (<b>-z</b> flag and <b>zdiff</b> option)</li>
<li>same categories (<b>-c</b> flag)</li>
<li>count of points (<b>-f</b> flag and <b>cell_limit</b> option)</li>
</ul>

<p>
The grid-based decimation is currently using a 2D grid, so the points
are placed and compared within this 2D grid. The comparison can happen
using z coordinates or categories.
Note that although the grid is only 2D, the module works with 3D points.

<p>
The grid-based decimation extent and resolution depend on the current
computational region as set by <em><a href="g.region.html">g.region</a></em>.
As a consequence, the output is limited only to computational region
in this case.

<p>
TODO: Currently, any output is limited by the region.

<p>
The count-based decimation result highly depends on how the data are
ordered in the input. This applies especially to <b>offset</b> and
<b>limit</b> options where the resulting shape and densities can be
surprising. The options <b>skip</b> and <b>preserve</b> are influenced
by order of points in a similar way but they usually keep relative
density of points (which may or may not be desired).
On the other hand, the grid-based decimation will generally result in
more even density of output points (see Figure 1).

<p>
Besides decimation, point count can be reduced by applying different
selections or filters, these are:
<ul>
<li>selection by category (<b>cats</b> option)</li>
<li>selection by z values (<b>zrange</b> option)</li>
</ul>

<h2>NOTES</h2>

The grid-based decimation requires all points which will be saved in output
to fit into the computer's memory (RAM).
It is advantageous to have the region only in the area
with the points, otherwise unnecessary memory is allocated.
Higher (finer) resolutions and higher amount of preserved points
per cell require more memory.
The count-based decimation has no limitation regarding the available memory.

<p>
Significant speed up can be gained using <b>-b</b> flag which disables
building of topology for the output vector map. This may limit the use
of the vector map by some modules, but for example, this module works
without topology as well.

<h2>EXAMPLES</h2>

Keep only every forth point, throw away the rest:

<div class="code"><pre>
v.decimate input=points_all output=points_decimated_every_4 preserve=4
</pre></div>

<p>
Keep only points within a grid cell (given by the current computational
region) which has unique categories (e.g. LIDAR classes):

<div class="code"><pre>
v.decimate input=points_all output=points_decimated_unique_cats layer=1 -g -c
</pre></div>

<center>
    <img src="v_decimate_original.png">
    <img src="v_decimate_count.png">
    <img src="v_decimate_grid_cat.png">
    <p><em>
        Figure 1: Comparison of original points, decimation result
        with every forth point preserved, and grid-based decimation
        result with points with unique categories in each grid cell
    </em></p>
</center>

<p>
Keep only points with category 2 and keep only approximately 80% of the points:

<div class="code"><pre>
v.decimate input=points_all output=points_decimated_ skip=5 cats=2 layer=1
</pre></div>

<!--
g.region map=elev_lid792_1m
v.colors map=points_all use=cat rules=file.txt
2 brown
3:5 green
6 red
9 blue
11 black
13-14 gray
d.vect map=points color=none width=1 icon=basic/point
-->

<h2>REFERENCES</h2>

<ul>
<li> Petras, V., Petrasova, A., Jeziorska, J., Mitasova, H. (2016). Processing UAV
    and LiDAR point clouds in grass GIS. The International Archives of Photogrammetry,
    Remote Sensing and Spatial Information Sciences, 41, 945
    (<a href="https://doi.org/10.5194/isprsarchives-XLI-B7-945-2016">DOI</a>)</li>
</ul>

<h2>SEE ALSO</h2>

<em>
<a href="v.extract.html">v.extract</a>,
<a href="v.outlier.html">v.outlier</a>,
<a href="v.select.html">v.select</a>,
<a href="v.category.html">v.category</a>,
<a href="v.build.html">v.build</a>,
<a href="v.in.pdal.html">v.in.pdal</a>,
<a href="g.region.html">g.region</a>
</em>

<h2>AUTHOR</h2>

Vaclav Petras, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll Lab</a>