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.Morin@usherbrooke.ca> wrote:

> 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 x min and ymin are good but I want to select elements for which
>
> x max <= 457506
>
> y max <= 5384633
>
>
>
> The question seems probably trivial but it does not come out very clearly
> on
> the forum. I would very much appreciate it if anyone could shed some light
> on it.
>
> Many thanks in advance for your help !
>
> Nathalie
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

