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