3
<em>v.rast.stats</em> calculates basic univariate statistics from
4
a raster map only for the parts covered by the specified vector map.
5
The vector map will be rasterized according to the raster map resolution.
6
Then univariate statistics are calculated per vector category (cat) from
7
the raster map and the results uploaded to the vector map attribute table.
8
New columns are generated in the attribute table if not already present.
10
Nine columns are generated (n, min, max, range, mean, stddev, variance,
11
coeff_var, sum) according to the output of <em>r.univar</em>.
12
If the <b>-e</b> extended statistics flag is given the 1st quartile,
13
median, 3rd quartile, and given percentile are also calculated.
18
The module may take a long time to run if the raster region contains a large
19
number of cells. In this case the <b>--verbose</b> flag may be used to track
22
The script stops if a (prefixed) upload column is already present in the
23
vector map attribute table, unless otherwise instructed with the <b>-c</b>
24
continue flag. The column prefix will be separated from the statistic name
25
with an underscore. For example with a prefix of "<tt>elev</tt>" the sum
26
column will be named <tt>elev_sum</tt>.
28
If a DBF database is being used, note that column names are restricted by the
29
DBF specification to 10 characters. Therefore it is advised to be economical
30
in the use of the column prefix when using DBF as any additional characters
33
If a MASK is present, it will be restored after the script finished.
34
The script changes temporarily to the resolution of the given raster map.
36
<!-- r.univar limitation -->
37
Large amounts of system memory can be used when the <b>-e</b> extended
38
statistics flag is used with a very large region setting. If the region
39
is too large the module should display memory allocation errors.
40
Basic statistics can be calculated using any size input region.
45
Example to upload DEM statistics to ZIP codes vector map
46
(North Carolina sample dataset):
48
<div class="code"><pre>
49
g.copy vect=zipcodes_wake,myzipcodes_wake
50
# set computational region to DEM:
51
g.region rast=elevation -p
52
# calculate DEM statistics, upload to vector map table:
53
v.rast.stats myzipcodes_wake raster=elevation colprefix=elev
55
v.info -c myzipcodes_wake
56
v.db.select myzipcodes_wake
57
v.univar myzipcodes_wake column=elev_range type=centroid
64
<a href="r.univar.html">r.univar</a>,
65
<a href="v.univar.html">v.univar</a>,
66
<a href="v.what.rast.html">v.what.rast</a>,
67
<a href="v.what.vect.html">v.what.vect</a>
72
Markus Neteler, CEA (for the <a href="http://www.eden-fp6project.net/">EDEN EU/FP6 Project</a>)
75
<i>Last changed: $Date: 2011-11-08 10:42:51 +0100 (Tue, 08 Nov 2011) $</i>