[R-sig-Geo] Subsetting a spatial grid

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Dec 11 18:23:23 CET 2008


For SpatialGridDataFrames, row and col selection can be done by

object[firstrow:lastrow, firstcol:lastcol,]

after the last , you can optionally select attributes.
--
Edzer

Rob Robinson wrote:
> Help - please! :-)
>  I have what I thought was a really simple problem. I have a raster image of
> satellite data from which I would like to extract an arbitrary (but simple
> rectangular) portion for subsequent analysis (which I'll need to do for many
> images). I have the data as a (projected) SpatialGridDataFrame and have
> tried two approaches: create a SpatialPolygon and overlay it (but I don't
> think overlay does what I would like it to do), or access the coords slot of
> the data set and pick those within the range. I haven't been able to get
> either to work - presumably because my R is not good enough! It seems a
> fairly common task, but I haven't yet stumbled across an FAQ or page in
> ASDAR which seems to help. Any pointers anyone?
> Many thanks for any help
> Cheers
> rob
>
> *** Want to know about Britain's birds? Try  www.bto.org/birdfacts ***
>
> Dr Rob Robinson, Senior Population Biologist
> British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
> Ph: +44 (0)1842 750050        E: rob.robinson at bto.org
> Fx: +44 (0)1842 750030        W: www.bto.org/cv/rob_robinson.htm
>
> ==== "How can anyone be enlightened, when truth is so poorly lit" =====
>
> _______________________________________________
> 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