Re: [R-sig-Geo] Subset SpatialGridDataFrame by retrieving xy coordinates from bounding box

2012-10-16 Thread Nathalie Morin
Rolf, I converted my raster from SpatialGridDataFrame to SpatialPointsDataFrame, then to Spatial Point Pattern in spatstat : tls.dtm.SPDF <- SpatialPointsDataFrame(xy.sp, z.df) tls.dtm.spp <- as(tls.dtm.SPDF, "ppp") But what method do you suggest next for subsetting the spp ? Nathalie -- Vie

Re: [R-sig-Geo] Subset SpatialGridDataFrame by retrieving xy coordinates from bounding box

2012-10-16 Thread Nathalie Morin
For information, it worked with Robert's suggestions for 1 layer raster with : e <- extent(457446, 457506, 5384573, 5384633) b <- raster(tls.dtm) bb <- crop(b, e) # Or b <- brick(tls.dtm) b <- raster(b, 1) bb <- crop(b, e) Cheers, Nathalie -- View this message in context: http://r-sig-ge

Re: [R-sig-Geo] Subset SpatialGridDataFrame by retrieving xy coordinates from bounding box

2012-10-15 Thread Robert J. Hijmans
Natalie, library(raster) b <- brick(SGDF) e <- extent(457446, 457506, 5384573, 5384633) bb <- crop(b, e) # not sure what you want to do next, perhaps sge <- as(bb, 'SpatialGridDataFrame') Robert On Mon, Oct 15, 2012 at 5:54 PM, Nathalie Morin < nathalie.m.mo...@usherbrooke.ca> wrote: > Hel

Re: [R-sig-Geo] Subset SpatialGridDataFrame by retrieving xy coordinates from bounding box

2012-10-15 Thread Rolf Turner
This can be easily done in the "spatstat" package if you convert the object of interest to a spatial point pattern (object of class "ppp"). See the vignette "shapefiles" for some guidance on how to do the conversion. cheers, Rolf Turner On 16/10/12 13:54, Nathalie Morin wrote: Hel

[R-sig-Geo] Subset SpatialGridDataFrame by retrieving xy coordinates from bounding box

2012-10-15 Thread Nathalie Morin
Hello ! I am trying to subset elements from a SpatialGridDataFrame not by attribute, nor by indexing of rows/columns such as X[rows, columns], but by retrieving the xy coordinates from the bounding box. Example : > bbox(SGDF) min max x 457446 457512 y 5384573 5384637 The