Opened 15 years ago

Closed 5 years ago

#3116 closed enhancement (wontfix)

GDAL cannot read multiband ArcInfo Binary Grids

Reported by: jjr8 Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: GDAL_Raster Version: 1.6.0
Severity: normal Keywords: aigrid
Cc: Kyle Shannon

Description

I created a ArcInfo Binary Grid with 5 bands using ArcGIS 9.3.1. GDAL 1.6.0 cannot read it:

C:\>gdalinfo --version
GDAL 1.6.0, released 2008/12/04

C:\>gdalinfo c:\AIG_Multiband\ccomp2
ERROR 4: `c:\AIG_Multiband\ccomp2' not recognised as a supported file format.

gdalinfo failed - unable to open 'c:\AIG_Multiband\ccomp2'.

ArcCatalog reports the format of c:\AIG_Multiband\ccomp2 is "GRID Stack 7.x". The raster has five bands, all 250 x 250 cells. All of the cells of a given band have the same value, either 0, 1, or 255. (This raster was part of an experiment and does not represent real-world data.)

Frank W indicated that he would like to look at this raster to try to understand the format. It is attached. Thanks for looking.

I have no idea if you want to fix this. It would be helpful to me but I can work around it by using a different format. Please adjust the ticket properties appropriately.

Attachments (1)

AIG_Multiband.zip (29.1 KB ) - added by jjr8 15 years ago.

Download all attachments as: .zip

Change History (7)

by jjr8, 15 years ago

Attachment: AIG_Multiband.zip added

comment:1 by warmerdam, 15 years ago

Component: defaultGDAL_Raster
Keywords: aigrid added
Milestone: 1.6.3
Type: defectenhancement

I have established that the stack consists of two files:

warmerda@gdal64[99]% ls -l ccomp2
total 20
-rw-r--r-- 1 warmerda warmerda 13208 2009-08-27 18:26 metadata.xml
-rw-r--r-- 1 warmerda warmerda    90 2009-08-27 18:26 stk.adf

The stk.adf file looks like:

warmerda@gdal64[101]% od -c ccomp2/stk.adf
0000000  \0  \0  \0 001   c   c   o   m   p   2   c   1                
0000020      \0  \0  \0  \0 002   c   c   o   m   p   2   c   2        
0000040              \0  \0  \0  \0 003   c   c   o   m   p   2   c   3
0000060                      \0  \0  \0  \0 004   c   c   o   m   p   2
0000100   c   4                      \0  \0  \0  \0 005   c   c   o   m
0000120   p   2   c   5                      \0
0000132

Each of the grids in the stack is parallel to this directory as a normal grid accessable with GDAL.

warmerda@gdal64[104]% du
24      ./ccomp2
28      ./ccomp2c1
28      ./ccomp2c2
28      ./ccomp2c3
28      ./ccomp2c4
28      ./ccomp2c5
160     ./info
376     .

It looks like it would be relatively easy to add a stack driver to pull together the grids, but I have no plans to do this in the short term and it seems that the individual grids are easily accessed already. They could be "stacked" for gdal with gdal_merge.py -separate.

comment:2 by jjr8, 15 years ago

I have no urgent need for this functionality so, for my part, I am ok with you deferring this to some future point.

Perhaps those who need to access multiband ArcInfo Binary Grids with GDAL could handle it like this:

  1. Try to open with the normal GDAL API. If that fails:
  1. Check that the raster path is a directory that contains a stk.adf file.
  1. Parse the stk.adf file to build a list of single-band AIGs. It looks like the format of that file consists of a list of binary records, where each record is a four-byte integer indicating the band number followed by a fixed-length, 14-character, null-terminated string specifying the single-band AIG. The 13 characters is expected because single-band AIGs are limited to this length. I have read elsewhere that the multiband AIG (the stack) is limited to 9 characters. This is probably so that Arc can append "c" followed by up to three decimal digits.
  1. Once you have the names, open them with the normal GDAL open API.

Looks like there is more info here: http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=About_the_ESRI_grid_format

comment:3 by jjr8, 15 years ago

Here are additional comments from the gdal-dev list.

-----Original Message-----
From: Peter J Halls
Sent: Friday, August 28, 2009 7:15 AM
To: Andrew Loughhead
Cc: Jason Roberts; gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] Does GDAL support ArcInfo Binary Grids with multiple bands?

Andrew is correct.  The ArcGIS grid stack comprises an index to the component 
grids, stackname.stk. The records comprise the grid names.  The grids must be in 
the same location (workspace) and have the same projection / coordinate system 
but do not need to have the same geographic extents (so long as there is an area 
of common overlap) or cell size.  Where the cell size differs, that quoted for 
the stack is the coarsest of the components.

It is quite common to use a stack to collect together raster layers representing 
disparate criteria in order to analyse them together, using geostats, for 
example.  A multi-band stack, such as, for example, might comprise a Landsat TM 
image, is a sort of special case.

Peter

Andrew Loughhead wrote:
> Jason Roberts wrote:
>>
>> Is the GDAL ArcInfo Binary Grid (AIG) driver intended to support AIGs 
>> with multiple bands? I have a 5-band AIG for which the Python gdal 
>> bindings for GDAL 1.6.0 report "`C:\Temp\ccomp2' not recognised as a 
>> supported file format." ArcGIS 9.3.1 reports that the "format" of it 
>> is "GRID Stack 7.x". It was created using standard ArcGIS tools.
>>
> I don't think that its quite right to see a GRID stack as an AIG with 
> multiple bands.
>  From (somewhat long term) memory an ArcInfo Grid Stack is actually a 
> collection of individual grids, rather than a single grid dataset with 
> multiple bands.  Within ArcInfo Workstation stacks can be converted to a 
> few multiband image formats, and multiband images converted to stacks.  
> I *think* that Stacks always have an INFO file, possibly called 
> <stackname>.stk, and I also think that the grids composing a stack had 
> to have identical bounds, and be in the same workspace.  Any particular 
> grid in a workspace could be in zero, one or more stacks.
> 
> Anyway I would expect that GDAL will deal fine with the individual grids 
> in the stack, as individual datasets.  Any GDAL utility, or binding, 
> which can combine individual datasets into a multiband image could 
> therefore convert a stack into an image.  Of course you would need to 
> know which individual grids form the stack.
> hth
> Andrew

comment:4 by Kyle Shannon, 13 years ago

Cc: Kyle Shannon added

comment:5 by Jukka Rahkonen, 6 years ago

GDAL 2.3dev can still read individual bands

C:\temp\AIG_Multiband\ccomp2c1>gdalinfo hdr.adf
Driver: AIG/Arc/Info Binary Grid
Files: .
       .\dblbnd.adf
       .\hdr.adf
       .\sta.adf
       .\vat.adf
       .\w001001.adf
       .\w001001x.adf
Size is 250, 250
Coordinate System is `'
Origin = (0.000000000000000,250.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left  (       0.000,     250.000)
Lower Left  (   0.0000000,   0.0000000)
Upper Right (     250.000,     250.000)
Lower Right (     250.000,       0.000)
Center      (     125.000,     125.000)
Band 1 Block=256x4 Type=Byte, ColorInterp=Undefined
  Min=0.000 Max=0.000
  NoData Value=255

It is unlikely that this feature request will ever be implemented but I let the ticket stay open.

comment:6 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.