Opened 7 years ago

Closed 11 months ago

#5074 closed defect (wontfix)

GDALReadDirect.cs does not read Arc/Info binary GRID files

Reported by: markusumueller Owned by: tamas
Priority: normal Milestone: closed_because_of_github_migration
Component: CSharpBindings Version: unspecified
Severity: normal Keywords: C# examples
Cc: warmerdam


I tried to read Arc/Info? Binary Grids and convert them to other image formats using the C#-bindings of GDAL. I installed the current binaries (MSVC2010 (Win64) -stable) from Then I started testing the example C# example programs especially GDALReadDirect.cs (from When I use the demo dataset utm.tif, this all works fine.

I then converted utm.tif to the Arc/Info? Binary Grid format using ArcMap? 10 (Conversion Tools - To Raster - Raster to other Format). When I try to use GDALReadDirect.cs I get the following error message:

Using driver Arc/Info? Binary Grid Band 1 : DataType?: GDT_Int16 Size (512,512) PaletteInterp?: GCI_Undefined OverView? 0 : DataType?: GDT_Int16 Size (256,256) PaletteInterp?: GCI_GrayIndex OverView? 1 : DataType?: GDT_Int16 Size (128,128) PaletteInterp?: GCI_GrayIndex The number of the raster bands is not enough to run this sample GDALReadDirect.cs obviously has an erroneous method named SaveBitMapDirect?, that first checks on the available Color interpretation and then on the number of bands. After the file is converted to Arc/Info? binary Grid format, the information about the Color interpretation is lost, so only then the program checks on the number of available bands and returns an error message. SaveBitMapDirect? works for the described case if Line 157 is edited:

if (redBand.GetRasterColorInterpretation?() == ColorInterp?.GCI_GrayIndex
redBand.GetRasterColorInterpretation?() == ColorInterp?.GCI_Undefined)

This is not a general fix, only for the immediate problem.

Attachments (1) (162.5 KB) - added by markusumueller 7 years ago.
Example dataset in Arc/Info? Binary GRID format

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by markusumueller

Attachment: added

Example dataset in Arc/Info? Binary GRID format

comment:1 Changed 7 years ago by warmerdam

Component: defaultCSharpBindings

comment:2 Changed 6 years ago by windchaser

Did you find a resolution to this question? I am also struggling with the same thing. I have some ArcInfo? raster files in text format and would like to produce a better color table for them, but I am unable to figure out how to do so.

Thanks, Daniel

comment:3 Changed 11 months ago by Even Rouault

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 if it is not already reported there.

Note: See TracTickets for help on using tickets.