howtos:how_to_calculate_an_area-weighted_average_in_grass
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| howtos:how_to_calculate_an_area-weighted_average_in_grass [2026-10-23 12:38 am] – created hcho | howtos:how_to_calculate_an_area-weighted_average_in_grass [2026-10-23 01:38 am] (current) – hcho | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| r.to.vect rast_val out=vect_val type=area | r.to.vect rast_val out=vect_val type=area | ||
| - | # overlay the value vector | + | # calculate the areas of the area vector polygons |
| + | v.to.db vect_val op=area col=area_m2 | ||
| + | |||
| + | # overlay the value vector | ||
| v.overlay ainput=vect_val binput=vect_area oper=or output=vect_val_area | v.overlay ainput=vect_val binput=vect_area oper=or output=vect_val_area | ||
| - | # calculate and validate | + | # add a new column for the area-weighted |
| - | # this command doesn' | + | v.db.addcolumn vect_area |
| - | v.db.select vect_val_area | + | |
| - | # add and populate | + | # populate |
| v.db.update vect_area col=avg_val \ | v.db.update vect_area col=avg_val \ | ||
| - | qcol=" | + | qcol=" |
| where vect_val_area.b_cat=vect_area.cat group by b_cat)" | where vect_val_area.b_cat=vect_area.cat group by b_cat)" | ||
| </ | </ | ||
howtos/how_to_calculate_an_area-weighted_average_in_grass.1792715933.txt.gz · Last modified: by hcho