Hi Sam,

Assign the ticket to me and I will apply the patch.

Thanks,

Ivan

Date: Wed, 4 Sep 2013 09:47:48 +1200
Subject: Re: [gdal-dev] HFA and RAT
From: [email protected]
To: [email protected]
CC: [email protected]

Hi Ivan, 

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.


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.

Sam.



--- gcore/gdal_rat.cpp.orig     Wed Sep  4 09:27:51 2013
+++ gcore/gdal_rat.cpp  Wed Sep  4 09:28:33 2013
@@ -502,6 +502,9 @@
     CPLXMLNode *psTree = NULL;
     CPLXMLNode *psRow = NULL;
 
+    if( ( GetColumnCount() == 0 ) && ( GetRowCount() == 0 ) )

+        return NULL;
+
     psTree = CPLCreateXMLNode( NULL, CXT_Element, "GDALRasterAttributeTable" );
 
 /* -------------------------------------------------------------------- */




On 4 September 2013 08:22, Ivan Lucena <[email protected]> wrote:




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?


Band 1 Block=64x64 Type=Byte, ColorInterp=Undefined
  Description = Layer_1
  Metadata:
    LAYER_TYPE=athematic
<GDALRasterAttributeTable />

Band 2 Block=64x64 Type=Byte, ColorInterp=Undefined

  Description = Layer_2
  Metadata:
    LAYER_TYPE=athematic
<GDALRasterAttributeTable />

Band 3 Block=64x64 Type=Byte, ColorInterp=Undefined
  Description = Layer_3
  Metadata:
    LAYER_TYPE=athematic

<GDALRasterAttributeTable />

It seems to me that the HFA driver is reporting incorrectly when the GDAL API 
function GDALGetDefaultRAT is called by gdalinfo.
                                          

_______________________________________________

gdal-dev mailing list

[email protected]

http://lists.osgeo.org/mailman/listinfo/gdal-dev

                                          
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to