[GRASS-user] How to get centroid coordinates

Alexander Muriy amuriy at gmail.com
Fri Aug 24 02:42:41 PDT 2012


Hi Margherita.

I have a vector of polygons and i want to create a vector of points with
> the centroids of the polygons, with a connected table showing their
> coordinates. Which is the simplest way to do that on G7?
>
>
In GRASS 6.4.*:
-- extract centroids from polygon map
v.extract in=poly out=centr type=centroid
-- if needed convert centroids to points
v.type in=centr out=centr_pts type=centroid,point
-- add attribute table to points
v.db.addtable centr_pts col="x double,y double,z double"
-- insert coords in table
v.to.db TMP_centr_pts option=coor col=x,y,z

I think in GRASS 7.0 it will be similar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120824/fa39fd6c/attachment.html>


More information about the grass-user mailing list