<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Sam,<br><br>Assign the ticket to me and I will apply the patch.<br><br>Thanks,<br><br>Ivan<br><br><div><hr id="stopSpelling">Date: Wed, 4 Sep 2013 09:47:48 +1200<br>Subject: Re: [gdal-dev] HFA and RAT<br>From: gillingham.sam@gmail.com<br>To: lucena_ivan@hotmail.com<br>CC: gdal-dev@lists.osgeo.org<br><br><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="ecxgmail_extra">
<br><br><div class="ecxgmail_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="ecxgmail_quote" style="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></div> </div></body>
</html>