Re: [R-sig-Geo] Population-weighted Centroids of Polygons in R

2016-02-23 Thread Jose M. Pavia
If I understand your problem. You can compute a global centroid for the large polygon directly as a weighted average. If Pi is the population of block i and (xi, yi) are the coordinates of the centroid of block i. the weighted average centroid of the polygon will be: x_w = sum(xi*Pi)/sum(Pi) y_

Re: [R-sig-Geo] Population-weighted Centroids of Polygons in R

2016-02-23 Thread Sohrab Abbasnejad via R-sig-Geo
Hi Loïc, Thank you so much for your reply. I went through the approach that you have already proposed. I believe it's a great idea.  I'd like to emphasize that the coordinates of the centroid of each block is available. The idea is how to relate these centroids to the corresponding population o

Re: [R-sig-Geo] Population-weighted Centroids of Polygons in R

2016-02-21 Thread Loïc Dutrieux
Hi Sohrab, I don't think there is a method for weighted centroids specifically. What if you get the centroid coordinates of each "block" using gCentroid() and calculate a weighted average of the coordinates of every centroid? See an example below assuming your blocks are a SpatialPolygonsDataF

[R-sig-Geo] Population-weighted Centroids of Polygons in R

2016-02-21 Thread Sohrab Abbasnejad via R-sig-Geo
Dear all, I have a set of spatial polygons and several blocks of population (with fixed area but a different number of people in each). I have used the "over" method from "sp" package to identify the blocks which are located inside these polygons. Now, utilizing R, I wish to assign to each of th