[R-sig-Geo] ENVI data and R

Roger Bivand Roger.Bivand at nhh.no
Tue Jul 29 22:24:37 CEST 2008


On Tue, 29 Jul 2008, Guy Serbin wrote:

> Thank you all for the help- I successfully read an image into R using
> these methods.
>
> I did, however, encounter some problems when loading a hyperspectral
> image cube into R as it was unable to allocate the 2.9 GB of volatile
> memory that it needed.

Buy more memory, 64-bit Linux works fine. Seriously, R is for statistics, 
so its memory management is designed for samples, even though very large 
samples can be handled when used appropriately. If your data are in a 
GeoTiff, you can read them by band using functions in the rgdal package, 
or equally well many bands in a window or tile of a larger scene. Note 
that ArcGIS uses GDAL too for handling some raster formats. Using R does 
mean thinking through your work flow.

Roger

>
> Is there a way to improve memory management by R, so that it only
> reads in the data when actually needed for processing, e.g., only read
> in the bands I need, or conversely read in spectra on a per-pixel
> basis?
>
> Guy
>
> On Tue, Jul 29, 2008 at 4:05 PM, PUJAN RAJ REGMI
> <regmi_pujan at hotmail.com> wrote:
>>
>> This might help to mange the orientation of image:
>>
>> # To read ENVI format
>> cir.image<-("YOUR_ENVI_FILE")
>> CIR.envi<-read.ENVI(cir.image,headerfile=paste(cir.image,".hdr",sep=""))
>> # To Show image
>> CIR.envi.band1<-CIR.envi[,,1]
>> CIR.envi.band1.s<-CIR.envi.band1[order(nrow(CIR.envi.band1):1),]
>> CIR.envi.band1.t<-t(CIR.envi.band1.s)
>> image(CIR.envi.band1.t,main="")
>> mtext("Raw Matrix ENVI Image for Band1", side=3,line=2, font=3,cex=1.25)
>>
>> Pujan
>> ________________________________
>>> From: andrew.niccolai at yale.edu
>>> To: guy.serbin at gmail.com; R-sig-Geo at stat.math.ethz.ch
>>> Date: Tue, 29 Jul 2008 14:24:04 -0400
>>> Subject: Re: [R-sig-Geo] ENVI data and R
>>>
>>> This code might help:
>>>
>>>
>>> ############################################################################
>>> ####
>>>
>>> ############################################################################
>>> ####
>>> ## Read in envi file
>>> cir.image <- "C:/YOUR_ENVI_FILE"
>>> CIR.envi = read.ENVI(cir.image, headerfile=paste(cir.image,".hdr",
>>> sep=""))
>>>
>>>
>>> ############################################################################
>>> ####
>>>
>>> ############################################################################
>>> ####
>>> ## Show image
>>> CIR.envi.band1 <- CIR.envi[,,1]
>>> image(CIR.envi.band1, main="")
>>> mtext("Raw Matrix ENVI Image for Band 1", side=3,line = 2, font=3,
>>> cex=1.25)
>>>
>>>
>>> ############################################################################
>>> ####
>>>
>>> ############################################################################
>>> ####
>>>
>>> Andrew Niccolai
>>> Doctoral Candidate
>>> Yale School of Forestry
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: r-sig-geo-bounces at stat.math.ethz.ch
>>> [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Guy Serbin
>>> Sent: Tuesday, July 29, 2008 12:55 PM
>>> To: R-sig-Geo at stat.math.ethz.ch
>>> Subject: [R-sig-Geo] ENVI data and R
>>>
>>> Hi,
>>>
>>> I was wondering if anyone knows how to either call up R functions from
>>> within IDL, or conversely read ENVI image data into R. If you have
>>> any advice I'd greatly appreciate it.
>>>
>>> Thanks,
>>> Guy Serbin
>>>
>>> --
>>> Guy Serbin, Ph.D.
>>> Research Soil Scientist
>>> Hydrology and Remote Sensing Lab
>>> Bldg 007 Rm 104 BARC-West
>>> 10300 Baltimore Blvd
>>> Beltsville, MD 20705-2350 USA
>>> +1(301)504-5250 guy.serbin at gmail.com
>>>
>>> _______________________________________________
>>> 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
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>> ________________________________
>> Stay in touch when you're away with Windows Live Messenger. IM anytime
>> you're online.
>
>
>
>

-- 
Roger Bivand
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 mailing list