1v.rast.stats(1) Grass User's Manual v.rast.stats(1)
2
3
4
6 v.rast.stats - Calculates univariate statistics from a raster map
7 based on a vector map and uploads statistics to new attribute columns.
8
10 vector, statistics, raster, univariate statistics, zonal statistics,
11 sampling, querying
12
14 v.rast.stats
15 v.rast.stats --help
16 v.rast.stats [-cd] map=name [layer=string] raster=name column_pre‐
17 fix=string [method=string[,string,...]] [percentile=integer]
18 [--help] [--verbose] [--quiet] [--ui]
19
20 Flags:
21 -c
22 Continue if upload column(s) already exist
23
24 -d
25 Create densified lines (default: thin lines)
26 All cells touched by the line will be set, not only those on the
27 render path
28
29 --help
30 Print usage summary
31
32 --verbose
33 Verbose module output
34
35 --quiet
36 Quiet module output
37
38 --ui
39 Force launching GUI dialog
40
41 Parameters:
42 map=name [required]
43 Name of vector map
44 Or data source for direct OGR access
45
46 layer=string
47 Layer number or name
48 Vector features can have category values in different layers. This
49 number determines which layer to use. When used with direct OGR
50 access this is the layer name.
51 Default: 1
52
53 raster=name [required]
54 Name of input raster map to calculate statistics from
55
56 column_prefix=string [required]
57 Column prefix for new attribute columns
58
59 method=string[,string,...]
60 The methods to use
61 Options: number, minimum, maximum, range, average, stddev, vari‐
62 ance, coeff_var, sum, first_quartile, median, third_quartile, per‐
63 centile
64 Default: number,minimum,maximum,range,average,stddev,vari‐
65 ance,coeff_var,sum,first_quartile,median,third_quartile,percentile
66
67 percentile=integer
68 Percentile to calculate
69 Options: 0-100
70 Default: 90
71
73 v.rast.stats calculates basic univariate statistics from a raster map
74 only for the parts covered by the specified vector map. The vector map
75 will be rasterized according to the raster map resolution. Then uni‐
76 variate statistics are calculated per vector category (cat) from the
77 raster map and the results uploaded to the vector map attribute table.
78 A new column is generated in the attribute table for each statistic
79 requested in method (if not already present).
80
81 The univariate statistics include the number of raster cells counted,
82 minimum and maximum cell values, range, average, standard deviation,
83 variance, coefficient of variation, sum, first quartile, median, third
84 quartile, and percentile.
85
87 v.rast.stats is only meaningful for lines or polygons.
88
89 The module may take a long time to run if the raster region contains a
90 large number of cells. In this case the --verbose flag may be used to
91 track progress.
92
93 The script stops if a (prefixed) upload column is already present in
94 the vector map attribute table, unless otherwise instructed with the -c
95 continue flag. The column prefix will be separated from the statistic
96 name with an underscore. For example with a prefix of "elev" the sum
97 column will be named elev_sum.
98
99 If a DBF database is being used, note that column names are restricted
100 by the DBF specification to 10 characters. Therefore it is advised to
101 be economical in the use of the column prefix when using DBF as any
102 additional characters will be chopped off.
103
104 If a MASK is present, it will be restored after the script finished.
105 The script changes temporarily to the resolution of the given raster
106 map.
107
108 Large amounts of system memory can be used when extended statistics
109 (first_quartile,median,third_quartile,percentile ) are being requested
110 with a very large region setting. If the region is too large the module
111 should display memory allocation errors. Basic statistics can be calcu‐
112 lated using any size input region.
113
115 Example to upload DEM statistics to ZIP codes vector map (North Car‐
116 olina sample dataset):
117 g.copy vect=zipcodes_wake,myzipcodes_wake
118 # set computational region to DEM:
119 g.region raster=elevation -p
120 # calculate DEM statistics, upload to vector map table:
121 v.rast.stats myzipcodes_wake raster=elevation \
122 column_prefix=elev method=minimum,maximum,average,range,stddev,percentile \
123 percentile=95
124 # verify results:
125 v.info -c myzipcodes_wake
126 v.db.select myzipcodes_wake
127 v.univar myzipcodes_wake column=elev_range type=centroid
128
130 r.univar, v.univar, v.vect.stats, v.what.rast, v.what.rast3,
131 v.what.vect
132
134 Markus Neteler, CEA (for the EDEN EU/FP6 Project)
135
136 Last changed: $Date: 2017-02-15 12:56:19 +0100 (Wed, 15 Feb 2017) $
137
139 Available at: v.rast.stats source code (history)
140
141 Main index | Vector index | Topics index | Keywords index | Graphical
142 index | Full index
143
144 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
145
146
147
148GRASS 7.4.4 v.rast.stats(1)