[R-sig-Geo] How to subset a spatial grid?
Roger.Bivand at nhh.no
Tue May 20 15:49:45 CEST 2008
On Tue, 20 May 2008, Edzer Pebesma wrote:
> Yong, I would have loved to see your R shaking.
Unless you do seismology, of course?
> This argument has been heard more often here. When processing massive grids,
> please have a look at the function getRasterData in package rgdal. It allows
> you to _read_ only portions of a grid.
This is the best current way to do things certainly, especially when many
bands/variables are involved. What I'm wondering is whether a class could
be written with an SQLiteDF sqlite.data.frame in the data slot? There is a
talk at useR! on a proposed SQLiteMap, but for vector data, and which
appears to miss sp classes, so I don't think that it is relevant.
> Yong Li wrote:
>> Thanks Edzer and Hengl. It works.
>> But R is really shaking when large grids are processed. We wish there is
>> improvement of sp in the future like GIS handling grids.
>> *From:* Edzer Pebesma [mailto:edzer.pebesma at uni-muenster.de]
>> *Sent:* Tue 20/05/2008 6:11 PM
>> *To:* Yong Li
>> *Cc:* r-sig-geo at stat.math.ethz.ch
>> *Subject:* Re: [R-sig-Geo] How to subset a spatial grid?
>> Have you tried
>> Map1 <- Map[1:100,1:100]
>> Note that this works differently for SpatialGridDataFrames and
>> SpatialPixelsDataFrames; the first knows about [rows,cols,bands], the
>> second about [pixels, bands].
>> Yong Li wrote:
>> > Dear All,
>> > I want to subset a large spatial grid (2000*2000) into many smaller
>> > grids for further processing in my simulation models. Could anyone do it
>> > before and any tips will be highly appreciated?
>> > Library(rgdal)
>> > Map <- readGDAL("yong.img") # one image from erdras imagine
>> > Map$va <- Map$band1
>> > Map$band1 <- NULL
>> > ????
>> > Map1 <- a subset of Map$va based on selected cols and rows.
>> > ????......
>> > Cheers
>> > Yong Li
>> > _______________________________________________
>> > R-sig-Geo mailing list
>> > R-sig-Geo at stat.math.ethz.ch
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo