On 01/03/2012 04:50 PM, Bulent Arikan wrote:
Dear List, I'm not sure about a shorter way, but here's an option: First setup your mapset to save attributes to sqlite. > v.db.connect centroid driver=sqlite database=.... Now add the columns which will accept r.univar values to the sqlite table: > v.db.addcol centroid col="n double, null_cells double, cells double, min double, max double, range double, mean double, mean_of_abs double, stddev double, variance double, coeff_var double, sum double" Run r.univar on your raster, putting results into a text file > r.univar your_rast -g > univar.txt Now do this loop to update values for the centroid: > while read l; do \ col=`echo $l | cut -d= -f1`; val=`echo $l | cut -d= -f2`; \ sqlite3 sqlite.db "UPDATE centroid SET ${col}=${val} ;"; \ > done < univar.txt Assuming you want to run this for several centroids/areas, you'll probably want to add a WHERE clause to the UPDATE statement so as to put values for only one certain row (centroid). HTH, Micha
-- Micha Silver GIS Consultant, Arava Development Co. http://www.surfaces.co.il |
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user