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

Rolf Turner r.turner at auckland.ac.nz
Tue Oct 16 03:00:58 CEST 2012


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:
> 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list