Thanks Markus, Cheers
milton 2014/1/25 Markus Neteler <[email protected]> > On Sat, Jan 25, 2014 at 12:10 AM, Milton Ribeiro > <[email protected]> wrote: > > Dear all, > > > > I have a polygon vector, and need to add point in the center of mass of > each > > one. > > I used v.centroid, but it adds just a centroid, but not in the central > > position of the polygon area. > > > > any hint are welcome! > > > I take liberty to cite a previous email here which is somewhat related: > > > On Tue, Feb 28, 2012 at 8:48 PM, Hamish <[email protected]> wrote: > > Vishal wrote: > >> i'm interested in estimating the centre of population of a city > >> and how it might have changed in 10 years. i have a vector > >> polygon layer for each year, which is the ward population. > >> each layer has 198 polygons(wards) with population attributes > >> for each polygon(ward). The distribution of population within > >> a ward is not known, hence assumed uniform for now. > >> > >> is there a module in GRASS for calculating this. i know we can > >> calculate geographic centroids, but was'nt sure if there was > >> one for this kind of thing. > >> > >> Otherwise i could do it manually by extracting the geographic > >> centroid of each polygon, then the coordinates of the > >> population centre would be: > >> > >> xhat = sum(Pi Xi) /(sum(Pi) > >> yhat = sum(Pi Yi) / sum(Pi) > >> > >> where Xi, Yi are each polygon i's geographic centroids; and > >> Pi are each polygon's population coordinates are in UTM. > > > > Hi, > > > > This won't really answer your question, but fyi the centroid > > position is calculated by Vect_find_poly_centroid() like this: > > > > > http://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/poly.c#L309 > > > > but then tested to see if the point is within the polygon. > > beware of "C" or "O" shaped wards, where the center of mass > > (or the more simple center of the bounding box) may not be. > > > > and if you did have population data instead of polygons there > > is an addon script for that: > > http://grass.osgeo.org/wiki/AddOns#v.points.cog > > > > "v.points.cog is a shell script which will create a new point at > > the center of gravity of each cluster of input points or > > centroids, grouped by attribute. Among other things this is > > useful for labeling swarms of points." > > (actual link: > http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#v.points.cog > ) > > > maybe it helps one day.. > > > > Hamish > > Due to the shape issue there is no general solution, it depends on the > data. > > Maybe other list members have further suggestions. > > Markus > -- Miltinho - [email protected] Laboratório de Ecologia Espacial e Conservação - LEEC Depto de Ecologia - UNESP - Rio Claro Av. 24A, 1515- Bela Vista 13506-900 Rio Claro, SP, Brasil Fone: +55 19 3526-9647 (office) 19 3526-9680 (lab) Cel: 19 9853-3220 / 19 9853-5430 Depto Ecologia http://ib.rc.unesp.br/#!/departamentos/ecologia/ PG ECO & BIODIV http://ib.rc.unesp.br/#!/departamentos/ecologia/pos-graduacao-em-ecologia-e-biodiversidade/ CV http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4792988H6&mostrarNroCitacoesISI=true&mostrarNroCitacoesScopus=true Google citations http://scholar.google.com/citations?user=OWX_2eAAAAAJ
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
