# FreeBSD Manual Pages

v.vect.stats(1) GRASS GIS User's Manual v.vect.stats(1)NAMEv.vect.stats- Count points in areas, calculate statistics from point attributes.KEYWORDSvector, attribute table, database, univariate statistics, zonal statis- ticsSYNOPSISv.vect.statsv.vect.stats--helpv.vect.stats[-p]points=nameareas=name[type=string[,string,...]] [points_layer=string] [points_cats=range] [points_where=sql_query] [areas_layer=string] [areas_cats=range] [areas_where=sql_query] [method=string] [points_column=name] [count_column=name] [stats_column=name] [separator=character] [--help] [--verbose] [--quiet] [--ui]Flags:-pPrint output to stdout, do not update attribute table First column is always area category--helpPrint usage summary--verboseVerbose module output--quietQuiet module output--uiForce launching GUI dialogParameters:points=nameA[required]Name of existing vector map with points Or data source for direct OGR accessareas=nameA[required]Name of existing vector map with areas Or data source for direct OGR accesstype=string[,string,...] Feature type Input feature type Options:point,centroidDefault:pointpoints_layer=stringLayer 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 ac- cess this is the layer name. Default:1points_cats=rangeCategory values for points map Example: 1,3,7-9,13points_where=sql_queryWHERE conditions of SQL statement without 'where' keyword for points map Example: income < 1000 and population >= 10000areas_layer=stringLayer 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 ac- cess this is the layer name. Default:1areas_cats=rangeCategory values for area map Example: 1,3,7-9,13areas_where=sql_queryWHERE conditions of SQL statement without 'where' keyword for area map Example: income < 1000 and population >= 10000method=stringMethod for aggregate statistics Options:sum,average,median,mode,minimum,min_cat,maximum,max_cat,range,stddev,variance,diversitypoints_column=nameColumn name of points map to use for statistics Column of points map must be numericcount_column=nameColumn name to upload points count Column to hold points count, must be of type integer, will be cre- ated if not existingstats_column=nameColumn name to upload statistics Column to hold statistics, must be of type double, will be created if not existingseparator=characterField separator Special characters: pipe, comma, space, tab, newline Default:pipeDESCRIPTIONv.vect.statscounts the number of points in vector mappointsfalling into each area in vector mapareas. Optionally statistics on point at- tributes inpointsare calculated for each area. The results are either uploaded to the attribute table of the vector mapareasor printed to stdout.StatisticalMethods:Using numeric attribute values of all points fall- ing into a given area, a new value is detmined with the selected method.v.vect.statscan perform the following operations:sumThe sum of values.averageThe average value of all point attributes (sum / count).medianThe value found half-way through a list of the attribute values, when these are ranged in numerical order.modeThe most frequently occurring value.minimumThe minimum observed value.min_catThe point category corresponding to the minimum observed value.maximumThe maximum observed value.max_catThe point category corresponding to the maximum observed value.rangeThe range of the observed values.stddevThe statistical standard deviation of the attribute values.varianceThe statistical variance of the attribute values.diversityThe number of different attribute values.NOTESPoints not falling into any area are ignored. Areas without category (no centroid attached or centroid without category) are ignored. If no points are falling into a given area, the point count is set to 0 (zero) and the statistics result to "null". The columnscount_columnandstats_columnare created if not yet exist- ing. If they do already exist, thecount_columnmust be of type integer and thestats_columnof type double precision. In case thatv.vect.statscomplains about thepoints_columnof the in- put points vector map not being numeric, the modulev.db.updatecan 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.EXAMPLESPreparationforexamplesThe subsequent examples are based on randomly sampled elevation data (North Carolina sample database): # 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 These vector maps are used for the examples below.CountpointsperpolygonwithprintedoutputSeeaboveforthecreationoftheinputmaps.Counting points per polygon, print results to terminal: v.vect.stats points=rand5000 area=myzipcodes_wake -pCountpointsperpolygonwithcolumnupdateSeeaboveforthecreationoftheinputmaps.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_pointsAveragevaluesofpointsinpolygonwithprintedoutputSeeaboveforthecreationoftheinputmaps.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 -pAveragevaluesofpointsinpolygonwithcolumnupdateSeeaboveforthecreationoftheinputmaps.Calculation of average point elevation per ZIP code polygon, with up- date of "avg_elev" column and counting of points per polygon, with up- date of "num_points" column (new columns will be automatically cre- ated): # 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_elevPointstatisticsinahexagonalgridThe grid extent and size is influenced by the current computational re- gion. The extent is based on the vector mappoints_of_interestfrom the basic North Carolina sample dataset. g.region vector=points_of_interest res=2000 -pa The hexagonal grid is created using thev.mkgridmodule as a vector map based on the previously selected extent and size of the grid. v.mkgrid map=hexagons -h Thev.vect.statsmodule counts the number of points and does one sta- tistics on a selected column (here:elev_m). v.vect.stats points=points_of_interest areas=hexagons method=average \ points_column=elev_m count_column=count stats_column=average User should note that some of the points may be outside the grid since the hexagons cannot cover all the area around the edges (the computa- tional region extent needs to be enlarged if all points should be con- sidered). The last command sets the vector map color table to viridis based on the count column. v.colors map=hexagons use=attr column=average color=viridis Point statistics in a hexagonal grid (count of points, average of val- ues associated with point, standard deviation)SEE ALSOv.distance,r.distance,v.rast.stats,v.what.vect,v.mkgridAUTHORMarkus MetzSOURCE CODEAvailable at: v.vect.stats source code (history) Main index | Vector index | Topics index | Keywords index | Graphical index | Full indexA(C) 2003-2020 GRASS Development Team, GRASS GIS 7.8.3 Reference Manual GRASS 7.8.3 v.vect.stats(1)

NAME | KEYWORDS | SYNOPSIS | DESCRIPTION | NOTES | EXAMPLES | SEE ALSO | AUTHOR | SOURCE CODE

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=v.vect.stats&sektion=1&manpath=FreeBSD+12.2-RELEASE+and+Ports>