[GRASS-user] vectors: how to find the gravitation centre of point data ?

Hamish hamish_b at yahoo.com
Fri Dec 5 21:31:05 EST 2008


Moritz wrote:
> > Another (very wild) guess: what about the mean of the coordinates
> > of the individual polygons' centroids ?

Peter Löwe wrote:
> That would be great if it could be automated.

#spearfish
g.copy vect=archsites,tmp_arch
v.db.addcol tmp_arch column='x double, y double'
v.to.db tmp_arch option=coor columns=x,y

eval `v.univar -g tmp_arch column=x type=point | grep -w mean`
X_MEAN=$mean

eval `v.univar -g tmp_arch column=y type=point | grep -w mean`
Y_MEAN=$mean

echo "Center of point cloud: $X_MEAN, $Y_MEAN"


one thing there- v.univar output for y coord results in 4.92146e+06.
see trac bug #335  (improve variable output precision)
http://trac.osgeo.org/grass/ticket/335


Hamish



      



More information about the grass-user mailing list