[R-sig-Geo] subsetting

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Oct 24 13:08:09 CEST 2008


Pieter,

the easiest in terms of the least mental exercise might be to form a
polygon from the four points and then overlay that with the grid. This
will likely be too slow and/or memory intensive.

The more efficient way would be to compute the row and column index
ranges from the bounding box, and index the SpatialGridDataFrame with
that. gridparameters(x) gives you the necessary information for this.
--
Edzer

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
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de




More information about the R-sig-Geo mailing list