[R-sig-Geo] subsetting

Paul Hiemstra p.hiemstra at geo.uu.nl
Fri Oct 24 09:28:24 CEST 2008


Which version of R and sp are you using? I'm asking this because I had a 
similar problem as you had with a raster of 50.000+ points and some 7000 
polygons (not sure if this is comparable to your dataset). Doing the 
overlay took far too long, but after a question about this to the 
r-sig-geo list, Roger Bivand extended the code for point.in.polygon to 
first make a subset of the polygons based on the bounding boxes of the 
polygons (fast operation) and then perform a point in polygon operation. 
I'm not really sure from which version of sp this feature is included, 
but it should be included in the latest version (Roger?). Maybe an 
upgrade would solve your problem, it did mine.

hope this helps,

Pieter Beck wrote:
> 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 at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145

More information about the R-sig-Geo mailing list