[GRASS-user] calculating centre of mass?
Hamish
hamish_b at yahoo.com
Tue Feb 28 14:48:36 EST 2012
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."
maybe it helps one day..
Hamish
More information about the grass-user
mailing list