[gdal-dev] Bug in of GDALRead.cs

Markus Müller markus.u.mueller at zoho.com
Thu May 9 13:52:36 PDT 2013


Tamas and Frank,

the (supposed) bug is still the same with the files from http://svn.osgeo.org/gdal/trunk/gdal/swig/csharp/apps/.
I created a trac ticket as suggested by Tamas: http://trac.osgeo.org/gdal/ticket/5074.




Cheers,


Markus

---- On Thu, 09 May 2013 10:51:23 -0700 Frank Warmerdam <warmerdam at pobox.com> wrote ---- 


Markus,

Ah, I see.  The up to date sample scripts can also be found at:


  http://svn.osgeo.org/gdal/trunk/gdal/swig/csharp/apps/
 

The examples in FWTools are likely very out of date.


Best regards,
Frank

On Wed, May 8, 2013 at 6:57 PM, markus.u.mueller <markus.u.mueller at zoho.com> wrote:
  Frank,

that is what I am using (Tamas' SDK), perhaps my email was not clear enough. The example .cs files (and that is where I found the bug) though are only available via FWTools. Makes sense?
 This example files are not strictly part of the C#-bindings, but as they are the only documentation available I figured it makes sense to fix them.




Cheers,


 Markus




---- On Wed, 08 May 2013 15:57:05 -0700 Frank Warmerdam <warmerdam at pobox.com> wrote ---- 

 
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
 
  










-- 
---------------------------------------+--------------------------------------
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/20130509/df083e99/attachment.html>


More information about the gdal-dev mailing list