howtos:how_to_calculate_an_area-weighted_average_in_grass
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| howtos:how_to_calculate_an_area-weighted_average_in_grass [2026-10-23 12:50 am] – hcho | howtos:how_to_calculate_an_area-weighted_average_in_grass [2026-11-07 03:12 pm] (current) – hcho | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| <code bash> | <code bash> | ||
| # set the computational region to the value raster | # set the computational region to the value raster | ||
| - | g.region rast=rast_val | + | g.region rast=val_rast |
| # convert the value raster to area vector | # convert the value raster to area vector | ||
| - | r.to.vect | + | r.to.vect |
| # overlay the value vector OR the area vector | # overlay the value vector OR the area vector | ||
| - | v.overlay ainput=vect_val | + | v.overlay ainput=val_vect |
| - | # calculate | + | # calculate the areas of the value-OR-area vector |
| - | # this command doesn' | + | v.to.db val_area_vect op=area |
| - | v.db.select vect_val_area | + | |
| - | group=b_cat | + | |
| - | # add and populate | + | # add a new column for the area-weighted average |
| - | v.db.update | + | v.db.addcolumn area_vect col=" |
| - | qcol=" | + | |
| - | | + | # populate the new column with the area-weighted average |
| + | v.db.update | ||
| + | qcol=" | ||
| + | | ||
| </ | </ | ||
howtos/how_to_calculate_an_area-weighted_average_in_grass.1792716659.txt.gz · Last modified: by hcho