[R-sig-Geo] extract value from grid and calculate weighted.mean of pixel

Tom Gottfried tom.gottfried at wzw.tum.de
Sun Apr 5 14:02:27 CEST 2009

Hi Gianni,

you could possibly use the function `readShapePoly' in the package  
maptools to import your shapefile into an object of class  
SpatialPolygonsDataFrame. To extract the raster values inside the  
single polygons of your SpatialPolygonsDataFrame-object and to  
calculate their mean you can use the function `overlay' from the  
package sp.

Hope this helps,

More information about the R-sig-Geo mailing list