[R] Importing BSQ/BIP/BIL files into R

Roger Bivand Roger.Bivand at nhh.no
Fri Feb 13 08:52:31 CET 2004


On Thu, 12 Feb 2004, Jonathan Greenberg wrote:

> I was hoping I could get some help with an import question.  I work with
> remote sensing imagery which commonly comes in binary form in various
> interleaving formats (byte interleaved by line, by pixel, etc..).  These
> files are 2d spatial x B bands in size, and I want to be able to extract the
> band values from various pixels (so each line of data into R would be one
> pixel x B bands).
> 
> What's the easiest way of importing this type of data?  These files are
> often massive (4 - 16gb), so is there a way of having R read the lines of
> the data as I am running the process, rather than trying to load the whole
> image into memory at once?  Thanks!  For those of you with remote sensing
> experience, I'm using RSI's ENVI package.

You may like to use the R bindings to GDAL in package rgdal. You need to 
have installed GDAL first, and then install the R source package, so this 
works on Unix/Linux, and probably Mac OSX, but on Windows you need to 
build GDAL under MSYS/MinGW, and alter Makevars in rgdal/src by hand. 
Because rgdal binds to GDAL, it allows selection of subscenes. If you have 
the PROJ.4 library installed too, it may provide geo-referencing, but 
YMMV. Contact me off-list if this is worth following up.

Roger

-- 
Roger Bivand
Econonic Geography Section, Department of Economics, Norwegian School of 
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, 
Norway, voice: +47-55959355, fax: +47-55959393; Roger.Bivand at nhh.no




More information about the R-help mailing list