[GRASS-user] AVIRIS data in GRASS

Dylan Beaudette debeaudette at ucdavis.edu
Mon Jul 6 16:48:06 EDT 2009


On Monday 06 July 2009, Michael Perdue wrote:
> I was able to generate a ENVI style header that will allow you to read
> the files with GDAL. Modify as necessary and you should be able to
> work with the *.img files.

Fantastic. Thanks for the tips Mike. I will give this a try. For the record, 
Frank W. over on the GDAL mailing list suggested the code samples below. A 
script could be used to generate a single file for all 224 bands.

# make one of these for the entire set of data
# add more VRTRasterBand elements for the bands you want:
#
<VRTDataset rasterXSize="614" rasterYSize="512">
   <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
     <SourceFilename
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>0</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

# multi-band example:
<VRTDataset rasterXSize="614" rasterYSize="512">
   <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
     <SourceFilename
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>0</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
   <VRTRasterBand dataType="Int16" band="2" subClass="VRTRawRasterBand">
     <SourceFilename
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>2</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

This works well in QGIS-- and I imagine in GRASS as well. The tricky part from 
here is applying the rectification and "navigation" parameters...

Cheers,
Dylan


> On 5-Jul-09, at 6:56 PM, Michael Perdue wrote:
> > ... you might be able to manipulate GDAL to read it. If you can
> > create a header file for a generic binary file that will provide
> > GDAL with the number of rows, columns, byte order, #channels, # of
> > bytes/sample and the interleave method then you can tell GDAL how to
> > read it.
> >
> > On 5-Jul-09, at 3:49 PM, Dylan Beaudette wrote:
> >>  I
> >> have tried working with the "radiance" data, which when uncompressed
> >> comes with several .img files-- however my copy of GDAL does not know
> >> what to make of it. It looks like it may be possible [2] to import
> >> the
> >> data using r.in.bin... I was not able to get this working.
>
> Cheers,
>
> Mike



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-user mailing list