[R-sig-Geo] rectangular subsetting/clipping of sp objects (grids)

jgarcia at ija.csic.es jgarcia at ija.csic.es
Wed Nov 11 20:06:24 CET 2009


Hello, I am interested in subsetting/clipping rectangular areas of
imported spatial datasets (mostly raster) of sp classes.
While this is extremely easy to do with normal matrixes, I'm wondering if
there is a straigth way to do this for spatial objects (mostly
SpatialGridDataFrame objects).

In the list I've found a thread about clipping, but I just need simple
rectangular clipping from a specified bounding boxes I may require. The
point is to remove big imported objects from the workspace to save memory
and just work with the clipped areas.

Perhaps there is a simple way to do it? I mean something like:

n <- 4189000
s <- 4185000
w <- 655000
e <- 650000
mybbox <- matrix(c(e,s,w,n),ncol=2,dimnames=list(c("x","y"),c("min","max")))
x       <- readGDAL(myasciigrd)
bbox(x) <- mybbox

and obtain the clipping? Thanks you for your help.

Best regards,
Javier
---



More information about the R-sig-Geo mailing list