[R-sig-Geo] use Buffer for calculation on raster

Robert Hijmans r.hijmans at gmail.com
Fri Jul 22 19:02:54 CEST 2011

> I have created a list of buffer "spatialpolygons" which are stored in a
list (thx to Barry) but what I want
> to do, is now use the area of each buffer to calculate an mean from  a set
> of pixel values falling into
> that buffer. I thought the easiest way is to create shape files and use
> them with the raster package but
> I am struggeling with creating  shape files from that list
> Maybe I am thinking too complicated ?

How about this:

wb_new <- readShapeSpatial("G:/Students/Nelson/wb_studyarea.shp")#spatial
points used for the buffers 

# no loops!
bufs = gBuffer(wb_new, byid=TRUE, id=NULL, width=500, capStyle="ROUND") 

x <- extract(sc, bufs)

x should be a list with a length equal to the number of points in wb_new


View this message in context: http://r-sig-geo.2731867.n2.nabble.com/use-Buffer-for-calculation-on-raster-tp6610936p6611183.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list