<div dir="ltr">Markus,<div><br></div><div>Ah, I see. The up to date sample scripts can also be found at:</div><div><br></div><div> <a href="http://svn.osgeo.org/gdal/trunk/gdal/swig/csharp/apps/">http://svn.osgeo.org/gdal/trunk/gdal/swig/csharp/apps/</a></div>
<div><br></div><div>The examples in FWTools are likely very out of date.</div><div><br></div><div>Best regards,</div><div>Frank<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 8, 2013 at 6:57 PM, markus.u.mueller <span dir="ltr"><<a href="mailto:markus.u.mueller@zoho.com" target="_blank">markus.u.mueller@zoho.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><u></u><div><div style="font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif">
Frank,<div><br></div><div>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?</div>
<div>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.</div><div><br></div><div><br></div><div>Cheers,</div><div><br></div>
<div>Markus</div><div><br></div><div><br><div><br>---- On Wed, 08 May 2013 15:57:05 -0700 <b>Frank Warmerdam <<a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a>></b> wrote ---- <br></div><div>
<div class="h5"><br><blockquote style="border-left-width:1px;border-left-style:solid;border-left-color:rgb(0,0,255);padding-left:6px"><div dir="ltr">Markus,<div><br></div><div>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 (<a href="http://www.gisinternals.com/sdk/" target="_blank">http://www.gisinternals.com/sdk/</a>).</div>
<div><br></div><div>Best regards,</div><div>Frank</div></div><div><br><br><div>On Wed, May 8, 2013 at 3:07 PM, markus.u.mueller <span dir="ltr"><<a href="mailto:markus.u.mueller@zoho.com" target="_blank">markus.u.mueller@zoho.com</a>></span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><u></u><div><div style="font-size:10pt;font-family:verdana,arial,helvetica,sans-serif">
Dear listers,<div><br></div><div> <span style="line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif">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.</span></div>
<div><span style="line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif"><br></span></div><div><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
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 <a href="http://vbkto.dyndns.org/sdk/" target="_blank">http://vbkto.dyndns.org/sdk/</a>. Then I started testing the example C#-programs that are part of FWTools, especially GDALReadDirect.cs. When I use the demo dataset <code style="margin:0px;padding:1px 5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif">utm.tif</code>, this all works fine.</p>
<p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">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 <code style="margin:0px;padding:1px 5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif">GDALReadDirect.cs</code> I get the following error messages:</p>
<p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px"></p>
<pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif;overflow:auto;width:auto;max-height:600px">
<code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif"><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Using</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> driver </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Arc</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">/</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Info</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Binary</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Grid</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Band</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">DataType</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GDT_Int16 </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Size</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">(</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">512</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">,</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">512</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">)</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">PaletteInterp</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GCI_Undefined </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">OverView</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">DataType</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GDT_Int16 </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Size</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">(</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">256</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">,</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">256</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">)</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">PaletteInterp</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GCI_GrayIndex </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">OverView</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">DataType</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GDT_Int16 </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">Size</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">(</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">128</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">,</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0)">128</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">)</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">PaletteInterp</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> GCI_GrayIndex </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175)">The</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> number of the raster bands </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139)">is</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> not enough to run </span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139)">this</span><span style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> sample</span></code></pre>
<p></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<code style="margin:0px;padding:1px 5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif">GDALReadDirect.cs</code> obviously has an erroneous method named <code style="margin:0px;padding:1px 5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif">SaveBitMapDirect</code>, 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. <code style="margin:0px;padding:1px 5px;border:0px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,serif">SaveBitMapDirect</code> works for the described case if Line 157 is edited:</p>
<p style="clear:both;vertical-align:baseline;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px"><font face="Arial, Liberation Sans, DejaVu Sans, sans-serif"><span style="font-size:14px;line-height:18px">if (redBand.GetRasterColorInterpretation() == ColorInterp.GCI_GrayIndex || redBand.GetRasterColorInterpretation() == ColorInterp.GCI_Undefined)</span></font></p>
<p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">This is not a general fix, only for the immediate problem.</p>
<p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px"><br>
</p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<br></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
Cheers,</p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<br></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
Markus</p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<br></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<br></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:arial,'liberation sans','dejavu sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
<br></p></div><div><br></div></div></div><br>_______________________________________________<br> gdal-dev mailing list<br> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>---------------------------------------+--------------------------------------<br> I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br> and watch the world go round - Rush | Geospatial Software Developer<br> </div> </blockquote>
<br></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush | Geospatial Software Developer<br>
</div></div></div>