**-p**- Print output to stdout, do not update attribute table
- First column is always area category
**--help**- Print usage summary
**--verbose**- Verbose module output
**--quiet**- Quiet module output
**--ui**- Force launching GUI dialog

**points**=*name***[required]**- Name of existing vector map with points
- Or data source for direct OGR access
**areas**=*name***[required]**- Name of existing vector map with areas
- Or data source for direct OGR access
**type**=*string[,**string*,...]- Feature type
- Input feature type
- Options:
*point, centroid* - Default:
*point* **points_layer**=*string*- Layer number for points map
- Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
- Default:
*1* **points_cats**=*range*- Category values for points map
- Example: 1,3,7-9,13
**points_where**=*sql_query*- WHERE conditions of SQL statement without 'where' keyword for points map
- Example: income < 1000 and population >= 10000
**areas_layer**=*string*- Layer number for area map
- Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
- Default:
*1* **areas_cats**=*range*- Category values for area map
- Example: 1,3,7-9,13
**areas_where**=*sql_query*- WHERE conditions of SQL statement without 'where' keyword for area map
- Example: income < 1000 and population >= 10000
**method**=*string*- Method for aggregate statistics
- Options:
*sum, average, median, mode, minimum, min_cat, maximum, max_cat, range, stddev, variance, diversity* **points_column**=*name*- Column name of points map to use for statistics
- Column of points map must be numeric
**count_column**=*name*- Column name to upload points count
- Column to hold points count, must be of type integer, will be created if not existing
**stats_column**=*name*- Column name to upload statistics
- Column to hold statistics, must be of type double, will be created if not existing
**separator**=*character*- Field separator
- Special characters: pipe, comma, space, tab, newline
- Default:
*pipe*

*Statistical Methods:*
Using numeric attribute values of all points falling into a given area,
a new value is detmined with the selected method.
*v.vect.stats* can perform the following operations:

**sum**- The sum of values.
**average**- The average value of all point attributes (sum / count).
**median**- The value found half-way through a list of the attribute values, when these are ranged in numerical order.
**mode**- The most frequently occurring value.
**minimum**- The minimum observed value.
**min_cat**- The point category corresponding to the minimum observed value.
**maximum**- The maximum observed value.
**max_cat**- The point category corresponding to the maximum observed value.
**range**- The range of the observed values.
**stddev**- The statistical standard deviation of the attribute values.
**variance**- The statistical variance of the attribute values.
**diversity**- The number of different attribute values.

The columns *count_column* and *stats_column* are created if not
yet existing. If they do already exist, the *count_column* must be of
type integer and the *stats_column* of type double precision.

In case that *v.vect.stats* complains about the *points_column*
of the input points vector map not being numeric, the module
*v.db.update* can be used to perform type casting, i.e. adding and
populating an additional numeric column with the values type converted from
string attributes to floating point numbers.

# work on map copy for attribute editing g.copy vector=zipcodes_wake,myzipcodes_wake # set computational region: extent of ZIP code map, raster pixels # aligned to raster map g.region vector=myzipcodes_wake align=elev_state_500m -p # generate random elevation points r.random elev_state_500m vector=rand5000 n=5000 v.colors rand5000 color=elevation # visualization d.mon wx0 d.vect myzipcodes_wake -c d.vect rand5000

Counting points per polygon, print results to terminal:

v.vect.stats points=rand5000 area=myzipcodes_wake -p

Counting of points per polygon, with update of "num_points" column (will be automatically created):

v.vect.stats points=rand5000 area=myzipcodes_wake count_column=num_points # verify result v.db.select myzipcodes_wake column=ZIPCODE_,ZIPNAME,num_points

Calculation of average point elevation per ZIP code polygon, printed to terminal in comma separated style:

# check name of point map column: v.info -c rand5000 v.vect.stats points=rand5000 area=myzipcodes_wake \ method=average points_column=value separator=comma -p

Calculation of average point elevation per ZIP code polygon, with update of "avg_elev" column and counting of points per polygon, with update of "num_points" column (new columns will be automatically created):

# check name of point map column: v.info -c rand5000 v.vect.stats points=rand5000 area=myzipcodes_wake count_column=num_points \ method=average points_column=value stats_column=avg_elev # verify result v.db.select myzipcodes_wake column=ZIPCODE_,ZIPNAME,avg_elev

g.region vector=points_of_interest res=2000 -pa

v.mkgrid map=hexagons -h

v.vect.stats points=points_of_interest areas=hexagons method=average \ points_column=elev_m count_column=count stats_column=average

v.colors map=hexagons use=attr column=average color=viridis

Point statistics in a hexagonal grid (count of points, average of values associated with point, standard deviation)

*Last changed: $Date$*

Available at: v.vect.stats source code (history)

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2019 GRASS Development Team, GRASS GIS 7.6.2dev Reference Manual