Erdas Imagine .ige (Large Raster Spill File) Format

by Frank Warmerdam (warmerdam@pobox.com)

When creating images requiring more than 4GB of disk space in Imagine a two file dataset is created. The .img contains the traditional superstructure, but the actual image data is kept in a separate non-HFA file format, normally with the extension .ige. This is presumably done to get around the 32bit file offset limitations of HFA format which makes it impossible to address large images.

While the .ige file format does not appear to be publically documented anywhere, it is fortunately not that hard to deduce. The first thing to realize is that the traditional RasterDMS structure is missing from the base .img file. Instead it has a structure like the following:

    ExternalRasterDMS(ImgExternalRaster) 40 @ 2896
    + fileName = 
    +     string = `big.ige'
    + layerStackValidFlagsOffset[0] = 49
    + layerStackValidFlagsOffset[1] = 0
    + layerStackDataOffset[0] = 153341
    + layerStackDataOffset[1] = 0
    + layerStackCount = 1
    + layerStackIndex = 0

.ige Magic Header

Sample:

       0: 45524441 535F494D 475F4558 5445524E ERDAS_IMG_EXTERN
      16: 414C5F52 41535445 52000101 000000A0 AL_RASTER~~~~~~~
      32: 86010050 C3000040 00000040 00000003 ~~~P~~~@~~~@~~~~
      48: 00010000 0018E319 000E0300 001B0600 ~~~~~~~~~~~~~~~~
Fields:

Start Byte # of Bytes Format Name Description
0 26 ASCII Magic Header Always "ERDAS_IMG_EXTERNAL_RASTER\0".


.ige Layer Stack Prefix

The layer stack prefix is the first portion of a layer stack, appearing just before the valid flags. It is not directly referenced from the .img file. It is not clear if it is actually read by Imagine.

Sample: (starting at byte 26)

       
       0: 45524441 535F494D 475F4558 5445524E ERDAS_IMG_EXTERN
      16: 414C5F52 41535445 52000101 000000A0 AL_RASTER~~~~~~~
      32: 86010050 C3000040 00000040 00000003 ~~~P~~~@~~~@~~~~
      48: 00010000 0018E319 000E0300 001B0600 ~~~~~~~~~~~~~~~~
Fields:

Start Byte # of Bytes Format Name Description
X+0 1 Byte Unknown Unknown byte, has value of 1 in sample file (0 in overview) .
X+1 4 LSB Int32 layerCount Number of layers in file (ie. 1)
X+5 4 LSB Int32 width Width of raster in pixels (ie. 100000).
X+9 4 LSB Int32 height Height of raster in pixels (ie. 50000).
X+13 4 LSB Int32 blockWidth Width of a tile (usually 64).
X+17 4 LSB Int32 blockHeight Width of a tile (usually 64).
X+21 2 ? ? unknown 2 bytes, value of 0x03 0x00 in sample file (and 0x06 0x00 in overview).


.ige ValidFlags Section

This section is referred to by the layerStackValidFlagsOffset in the ExternalRasterDMS structure in the .img file, and basically consists of a bit array of valid flags for the tiles with a small bit of header info.

Sample:

      49: 01000000 18E31900 0E030000 1B060000 ~~~~~~~~~~~~~~~~
      65: 00000300 FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
      81: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
      97: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     113: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     129: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     145: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     161: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     177: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     193: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     209: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     225: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     241: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
     257: FFFFFFFF FFFFFF07 FFFFFFFF FFFFFFFF ~~~~~~~~~~~~~~~~
Fields:

Start Byte # of Bytes Format Name Description
X+0 4 LSB Int32 ? Unknown to (ie. 1).
X+4 4 ? ? Unknown (ie. 0x18 0xE3 0x19 0x00, or 0x00 9A 61 0A in overview).
X+8 4 LSB Int32 heightInBlocks Vertical tile count (ie. 782)
X+12 4 LSB Int32 widthInBlocks horizontal tile count (ie. 1563)
X+16 4 ? ? Unknown (ie. 0x00 0x00 0x03 0x00).
The bit array itself starts at X+20, and is packed with the first tile being the low order bit of the first byte. The bit array is widthInBlocks * heightInBlocks in size; however, the bit for the first tile in a row of tiles always starts on a byte boundary, and the extra space is filled with zeros. This accounts for the odd value at byte 263 in the sample, as this is the boundary between flags for two rowes of tiles.


.ige Image Data

The actual image data starts at the offset provided by layerStackDataOffset. The tiles are all uncompressed and presumably tightly packed. There is no tile index.


Acknowledgements

I would like to thank Mark Audin of Keyhole (Keyhole/Earthviewer) for bringing up the issue and offering some sample data and Erdas for allowing me to use Imagine to create a test file.