1v.rast.stats(1) Grass User's Manual v.rast.stats(1)
2
3
4
6 v.rast.stats - Calculates univariate statistics from a GRASS raster
7 map based on vector polygons and uploads statistics to new attribute
8 columns.
9
11 vector, raster, statistics
12
14 v.rast.stats
15 v.rast.stats help
16 v.rast.stats [-ce] vector=name [layer=integer] raster=name colpre‐
17 fix=string [percentile=integer] [--verbose] [--quiet]
18
19 Flags:
20 -c
21 Continue if upload column(s) already exist
22
23 -e
24 Calculate extended statistics
25
26 --verbose
27 Verbose module output
28
29 --quiet
30 Quiet module output
31
32 Parameters:
33 vector=name
34 Name of vector polygon map
35
36 layer=integer
37 Layer to which the table to be changed is connected
38 Default: 1
39
40 raster=name
41 Name of raster map to calculate statistics from
42
43 colprefix=string
44 Column prefix for new attribute columns
45
46 percentile=integer
47 Percentile to calculate (requires extended statistics flag)
48 Options: 0-100
49 Default: 90
50
52 v.rast.stats - Calculates basic univariate statistics from a raster map
53 only for the parts covered by the specified vector map. The vector map
54 will be rasterized according to the raster map resolution. Then uni‐
55 variate statistics are calculated per vector category (cat) from the
56 raster map and the results uploaded to the vector map attribute table.
57 New columns are generated in the attribute table if not already
58 present.
59
60 Nine columns are generated (n, min, max, range, mean, stddev, variance,
61 coeff_var, sum) according to the output of r.univar. If the -e
62 extended statistics flag is given the 1st quartile, median, 3rd quar‐
63 tile, and given percentile are also calculated.
64
66 The module may take a long time to run if the raster region contains a
67 large number of cells. In this case the --verbose flag may be used to
68 track progress.
69
70 The script stops if a (prefixed) upload column is already present in
71 the vector map attribute table, unless otherwise instructed with the -c
72 continue flag. The column prefix will be separated from the statistic
73 name with an underscore. For example with a prefix of "elev" the sum
74 column will be named elev_sum.
75
76 If a DBF database is being used, note that column names are restricted
77 by the DBF specification to 10 characters. Therefore it is advised to
78 be economical in the use of the column prefix when using DBF as any
79 additional characters will be chopped off.
80
81 If a MASK is present, it will be restored after the script finished.
82 The script changes temporarily to the resolution of the given raster
83 map.
84
85 Large amounts of system memory can be used when the -e extended statis‐
86 tics flag is used with a very large region setting. If the region is
87 too large the module should display memory allocation errors. Basic
88 statistics can be calculated using any size input region.
89
91 Example to upload DEM statistics to vector field patches:
92 # work on copy of original map:
93 g.copy vect=fields,myfields
94 # if needed, zoom to raster map:
95 g.region rast=elevation.dem -p
96 # calculate DEM statistics, upload to vector map table:
97 v.rast.stats myfields raster=elevation.dem colprefix=dem
98 # verify results:
99 v.info -c myfields
100 v.db.select myfields
101 v.univar myfields column=dem_range type=centroid
102
103
105 r.univar, v.univar, v.what.rast, v.what.vect
106
108 Markus Neteler, CEA (EDEN Project)
109
110 Last changed: $Date: 2007-10-10 08:11:21 +0200 (Wed, 10 Oct 2007) $
111
112 Full index
113
114 © 2003-2008 GRASS Development Team
115
116
117
118GRASS 6.3.0 v.rast.stats(1)