| 1 |
<h2>DESCRIPTION</h2> |
| 2 |
|
| 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). |
| 10 |
<p> |
| 11 |
The univariate statistics include the number of raster cells counted, |
| 12 |
the number of raster NULL cells counted, minimum |
| 13 |
and maximum cell values, range, average, |
| 14 |
standard deviation, variance, coefficient of variation, sum, first quartile, |
| 15 |
median, third quartile, and percentile. |
| 16 |
|
| 17 |
<h2>NOTES</h2> |
| 18 |
|
| 19 |
<em>v.rast.stats</em> is only meaningful for lines or polygons. |
| 20 |
<p> |
| 21 |
The module may take a long time to run if the raster region contains a large |
| 22 |
number of cells. In this case the <b>--verbose</b> flag may be used to track |
| 23 |
progress. |
| 24 |
<p>The script stops if a (prefixed) upload column is already present in the |
| 25 |
vector map attribute table, unless otherwise instructed with the <b>-c</b> |
| 26 |
continue flag. The column prefix will be separated from the statistic name |
| 27 |
with an underscore. For example with a prefix of "<code>elev</code>" the sum |
| 28 |
column will be named <code>elev_sum</code>. |
| 29 |
<p>If a DBF database is being used, note that column names are restricted by the |
| 30 |
DBF specification to 10 characters. Therefore it is advised to be economical |
| 31 |
in the use of the column prefix when using DBF as any additional characters |
| 32 |
will be chopped off. |
| 33 |
<p>The script internally aligns the raster grid cells to the grid of the first |
| 34 |
input raster map. |
| 35 |
<p>If an area has several categories in the selected layer (equivalent |
| 36 |
to overlapping polygons in Simple Features), only one category will be |
| 37 |
kept during the rasterization process. Statistics for the skipped |
| 38 |
categories will thus be partial. |
| 39 |
<p> |
| 40 |
For example, if there are three areas: area 1 with cat 1, area 2 with |
| 41 |
cat 2, area 3 with cats 1, 2. Only one category value of area 3 will be |
| 42 |
used for rasterization, the other category value will be skipped. Thus |
| 43 |
statistics for the used category value will be complete, while |
| 44 |
statistics for the skipped category value will be incomplete. |
| 45 |
<p> |
| 46 |
Large amounts of system memory can be used when extended statistics |
| 47 |
(<em>first_quartile,median,third_quartile,percentile </em>) are being requested |
| 48 |
with a very large region setting. If the region is too large the module |
| 49 |
should display memory allocation errors. Basic statistics can be calculated |
| 50 |
using any size input region. |
| 51 |
|
| 52 |
<h2>EXAMPLES</h2> |
| 53 |
|
| 54 |
Example to upload DEM statistics to ZIP codes vector map |
| 55 |
(North Carolina sample dataset): |
| 56 |
|
| 57 |
<div class="code"><pre> |
| 58 |
g.copy vect=zipcodes_wake,myzipcodes_wake |
| 59 |
# set computational region to DEM: |
| 60 |
g.region raster=elevation -p |
| 61 |
# calculate selected DEM statistics, upload to vector map table: |
| 62 |
v.rast.stats myzipcodes_wake raster=elevation \ |
| 63 |
column_prefix=elev method=minimum,maximum,average,range,stddev,percentile \ |
| 64 |
percentile=95 |
| 65 |
# verify results: |
| 66 |
v.info -c myzipcodes_wake |
| 67 |
v.db.select myzipcodes_wake |
| 68 |
v.univar myzipcodes_wake column=elev_range type=centroid |
| 69 |
</pre></div> |
| 70 |
|
| 71 |
<h2>SEE ALSO</h2> |
| 72 |
|
| 73 |
<em> |
| 74 |
<a href="r.univar.html">r.univar</a>, |
| 75 |
<a href="v.univar.html">v.univar</a>, |
| 76 |
<a href="v.vect.stats.html">v.vect.stats</a>, |
| 77 |
<a href="v.what.rast.html">v.what.rast</a>, |
| 78 |
<a href="v.what.rast3.html">v.what.rast3</a>, |
| 79 |
<a href="v.what.vect.html">v.what.vect</a> |
| 80 |
</em> |
| 81 |
|
| 82 |
<h2>AUTHOR</h2> |
| 83 |
|
| 84 |
Markus Neteler, CEA (for the <a href="https://cordis.europa.eu/project/id/10284">EDEN EU/FP6 Project</a>) |