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
A new column is generated in the attribute table for each statistic requested
9
in <b>method</b> (if not already present).
12
<em>v.rast.stats</em> is only meaningful for lines or polygons.
14
The module may take a long time to run if the raster region contains a large
15
number of cells. In this case the <b>--verbose</b> flag may be used to track
17
<p>The script stops if a (prefixed) upload column is already present in the
18
vector map attribute table, unless otherwise instructed with the <b>-c</b>
19
continue flag. The column prefix will be separated from the statistic name
20
with an underscore. For example with a prefix of "<tt>elev</tt>" the sum
21
column will be named <tt>elev_sum</tt>.
22
<p>If a DBF database is being used, note that column names are restricted by the
23
DBF specification to 10 characters. Therefore it is advised to be economical
24
in the use of the column prefix when using DBF as any additional characters
26
<p>If a MASK is present, it will be restored after the script finished.
27
The script changes temporarily to the resolution of the given raster map.
28
<p><!-- r.univar limitation -->
29
Large amounts of system memory can be used when extended statistics
30
(<em>first_quartile,median,third_quartile,percentile </em>) are being requested
31
with a very large region setting. If the region is too large the module
32
should display memory allocation errors. Basic statistics can be calculated
33
using any size input region.
37
Example to upload DEM statistics to ZIP codes vector map
38
(North Carolina sample dataset):
40
<div class="code"><pre>
41
g.copy vect=zipcodes_wake,myzipcodes_wake
42
# set computational region to DEM:
43
g.region raster=elevation -p
44
# calculate DEM statistics, upload to vector map table:
45
v.rast.stats myzipcodes_wake raster=elevation \
46
column_prefix=elev method=minimum,maximum,average,stddev,percentile \
49
v.info -c myzipcodes_wake
50
v.db.select myzipcodes_wake
51
v.univar myzipcodes_wake column=elev_range type=centroid
57
<a href="r.univar.html">r.univar</a>,
58
<a href="v.univar.html">v.univar</a>,
59
<a href="v.vect.stats.html">v.vect.stats</a>,
60
<a href="v.what.rast.html">v.what.rast</a>,
61
<a href="v.what.rast3.html">v.what.rast3</a>,
62
<a href="v.what.vect.html">v.what.vect</a>
67
Markus Neteler, CEA (for the <a href="http://www.eden-fp6project.net/">EDEN EU/FP6 Project</a>)
69
<p><i>Last changed: $Date: 2014-12-19 22:55:37 +0100 (Fri, 19 Dec 2014) $</i>