<div dir="ltr"><div><div>Hi Ivan, <br><br></div>Yes I can see this also with the trunk version. The problem is that with the RFC40 changes the HFA driver always returns something from GetDefaultRAT even if it is an empty table - you can now start writing data directly into the table with the returned object.<br>
<br></div>Below is a patch to prevent the Serialize() method returning anything when the row and column count is zero. I will submit this as a bug report if people think it is a good workaround.<br><br>Sam.<br><div><br><br>
--- gcore/gdal_rat.cpp.orig     Wed Sep  4 09:27:51 2013<br>+++ gcore/gdal_rat.cpp  Wed Sep  4 09:28:33 2013<br>@@ -502,6 +502,9 @@<br>     CPLXMLNode *psTree = NULL;<br>     CPLXMLNode *psRow = NULL;<br> <br>+    if( ( GetColumnCount() == 0 ) && ( GetRowCount() == 0 ) )<br>
+        return NULL;<br>+<br>     psTree = CPLCreateXMLNode( NULL, CXT_Element, "GDALRasterAttributeTable" );<br> <br> /* -------------------------------------------------------------------- */<br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 4 September 2013 08:22, Ivan Lucena <span dir="ltr"><<a href="mailto:lucena_ivan@hotmail.com" target="_blank">lucena_ivan@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div><div dir="ltr">Take any image, a screenshot of your desktop for example, save it as .bmp "gdal_translate" it to HFA, .img file, and run gdalinfo on it (trunk version). It's only me or at the end of the gdalinfo report do you also see <GDALRasterAttributeTable /> for each band?<br>
<br>Band 1 Block=64x64 Type=Byte, ColorInterp=Undefined<br>  Description = Layer_1<br>  Metadata:<br>    LAYER_TYPE=athematic<br><GDALRasterAttributeTable /><br><br>Band 2 Block=64x64 Type=Byte, ColorInterp=Undefined<br>
  Description = Layer_2<br>  Metadata:<br>    LAYER_TYPE=athematic<br><GDALRasterAttributeTable /><br><br>Band 3 Block=64x64 Type=Byte, ColorInterp=Undefined<br>  Description = Layer_3<br>  Metadata:<br>    LAYER_TYPE=athematic<br>
<GDALRasterAttributeTable /><br><br>It seems to me that the HFA driver is reporting incorrectly when the GDAL API function GDALGetDefaultRAT is called by gdalinfo.<br>                                           </div></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">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></div></div>