Count points in raster cells
Q: How can I count the number of points which fall into a raster cell? I want to count vector points by region resolution (quadrat count) and write the results to a raster map (in order to perform r.mapcalc on these observed frequencies).
A: Usewith 'method=n' which will count points per cell (resolution chosen with ) and write a raster map allocating the number count to the cell.
v.out.ascii input=myvec format=point | r.in.xyz input=- output=myras method=n type=FCELL x=1 y=2 z=3
Q: But what if I need to count vector areas and not points per raster cell?
A: Create vector grid with desired cell size; Overlay it with area layer You want to count; Adjust GRASS region to match vector grid and then use same method as described for points. Example found at GISnet.lv
v.mkgrid map=soil_grid grid=7,9 position=coor coor=595000,4920000 box=1000,1000 v.overlay ainput=soil_grid atype=area binput=soils@PERMANENT btype=area output=soil_on_grid operator=and g.region vect=soil_grid res=1000 v.out.ascii input=soil_on_grid format=point fs='|' dp=2 layer=1 where="b_label='VaB'" | \ r.in.xyz input=- output=VaB_count method=n