to get statistics of grids over polygons, you might also consider using the Grid Statistics for Polygons method in SAGA GIS:
> rsaga.get.modules("shapes_grid") $shapes_grid code name interactive 1 0 Add Grid Values to Points FALSE 2 1 Get Grid Data for Shapes FALSE 3 2 Grid Statistics for Polygons FALSE 4 3 Grid Values to Points FALSE 5 4 Grid Values to Points (randomly) FALSE 6 5 Contour Lines from Grid FALSE 7 6 Vectorising Grid Classes FALSE 8 7 Clip Grid with Polygon FALSE 9 8 Gradient from Grid FALSE > rsaga.get.usage("shapes_grid", 2) *Note that SAGA can handle even large grids/polygons (up to 2GB size). hth Tom Hengl http://spatial-analyst.net -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pieter Beck Sent: Thursday, October 23, 2008 9:15 PM To: r-sig-geo@stat.math.ethz.ch Subject: [R-sig-Geo] subsetting Dear all, I am a new user to the world of spatial applications of R and am wondering about this trivial question: What is the easiest way to subset a SpatialGridDataFrame, based on 4 corner coordinates? The reason I ask is that I want to do an overlay of a polygon file on a large raster dataset, to extract summary statistics from it. Both files are extremely large, however, and just applying overlay causes memory trouble. I was hoping to loop through the polygons, subset the SpatialGridDataFrame using the bounding box surrounding a polygon and then create the summary statistics one polygon at-a-time. To do this, I'd need to subset the SpatialGridDataFrame based on the bounding box corner coordinates. Thanks in advance for the help, Kind Regards, Pieter Beck [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo