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:
The columns count_column and stats_column are created if not existing. If they do already exist, the count_column must be of type integer and the stats_column of type double precision.
# 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
Last changed: $Date$