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

Alexander Arpaci alexander.arpaci at boku.ac.at
Fri Jul 22 17:47:49 CEST 2011


Hello list,



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 ?
my code so far
wb_new<-readShapeSpatial("G:/Students/Nelson/wb_studyarea.shp")#spatial points used for the buffers


bufs=list() # store results as elements of a list


for(i in 1:98){bufs[[i]]=gBuffer(wb_new[i,],byid=TRUE,id=NULL,width=500,capStyle="ROUND")}
plot(sc)# the raster where I want to use the buffere areas
for (i in 1:98){
plot(bufs[[i]],add=TRUE)}
#so I can plot everything together but still missing the next steps
every help is appreciated
alex
 sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Austria.1252  LC_CTYPE=German_Austria.1252   
[3] LC_MONETARY=German_Austria.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Austria.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rgdal_0.7-1     rgeos_0.1-8     spatstat_1.22-1 deldir_0.0-13  
 [5] mgcv_1.7-6      SDMTools_1.1-5  maptools_0.8-9  lattice_0.19-26
 [9] raster_1.8-31   sp_0.9-83       foreign_0.8-42 

loaded via a namespace (and not attached):
[1] grid_2.12.2        Matrix_0.999375-50 nlme_3.1-98  


MSc. Alexander Arpaci
Assistant researcher

Department of Forest - and Soil Sciences
Institute of Silviculture
Tel. +43-1-47654-4081
e-mail: alexander.arpaci at boku.ac.at
www.wabo.boku.ac.at 



More information about the R-sig-Geo mailing list