[gdal-dev] Bug in of GDALRead.cs

Frank Warmerdam warmerdam at pobox.com
Wed May 8 15:57:05 PDT 2013


Markus,

The GDAL C# bindings in FWTools is pretty ancient at this point so
reporting bugs against it is unlikely to result in improvements.  You might
want to upgrade to the latest version - either building from source, or
perhaps using Tamas' SDK (http://www.gisinternals.com/sdk/).

Best regards,
Frank


On Wed, May 8, 2013 at 3:07 PM, markus.u.mueller
<markus.u.mueller at zoho.com>wrote:

> **
> Dear listers,
>
> I  think I found a bug in GDALReadDirect.cs (part of FWTools). Is this the
> right place to record it? I will describe the problem anyway and would be
> willing to move it to another place if more appropriate.
>
> I want to read Arc/Info Binary Grids and convert them to other image
> formats using the C#-bindings of GDAL. I installed FWTools 2.4.7 and the
> current binaries (MSVC2010 (Win64) -stable) from
> http://vbkto.dyndns.org/sdk/. Then I started testing the example
> C#-programs that are part of FWTools, especially  GDALReadDirect.cs. 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 messages:
>
> 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.
>
>
>
> Cheers,
>
>
> Markus
>
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130508/71ad9b81/attachment-0001.html>


More information about the gdal-dev mailing list