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