[GRASS-dev] easy way to load x, y (of centroid) and top, bottom, left, right coordinates to attribute table?

Helmut Kudrnovsky hellik at web.de
Sat Jan 28 04:11:02 PST 2017

>I don't know which tool you used in QGIS, 

it's quite easy in QGIS, just open the attribute table for editing and type

x (centroid(  $geometry )) 
y (centroid(  $geometry ))

in the calculator for calculating the centroid coordinates.

>but GRASS' centroids are not
>guaranteed to be the geometrical centroid (aka "center of gravity" which
>could sometimes fall outside the polygon). 

ah yes, you're right.

>You might want to compare the
>results of QGIS with those of the addon v.centerpoint. 

v.centerpoint input=testcalculate output=testcalculate_center_of_gravity 

v.db.select map=testcalculate_center_of_gravity columns=x,y,x3,y3         

yes, GRASS' "center of gravity" (x3,y3) and QGIS centroids (x,y) are the


best regards
View this message in context: http://osgeo-org.1560.x6.nabble.com/easy-way-to-load-x-y-of-centroid-and-top-bottom-left-right-coordinates-to-attribute-table-tp5305135p5305180.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

More information about the grass-dev mailing list