[R-sig-Geo] Extract attributes from spatial polygons dataframe to another spatial polygons dataframe

Katharine Walter katharine.walter at yale.edu
Thu Sep 25 03:23:35 CEST 2014


I would like to extract attributes from one spatial polygons dataframe to

Specifically, I have a spatial polygons dataframe representing data
collected for towns and I would like to extract data into another overlaid
spatial polygon dataframe (a regular grid).  The dataframe is
complex--several variables are measured for several years for each town.
Ideally, what I would like to do do is weight the variables measured at the
town-level by the proportion of the town's area in each grid cell so that I
can find a total for the grid cell in question.  I have looked through the
offerings for spatial polygon dataframes, but have not found any tool for

Is the best way to do this to create a RasterStack for each variable of
interest which includes a RasterLayer for each year of interest and then
use extract(town, grid, weight=T) over each variable/year in questions?  Or
is there a way to do this if the data is represented as a STFDF or a
spatial polygons dataframe?

Thank you for your help!

	[[alternative HTML version deleted]]

More information about the R-sig-Geo mailing list