[gdal-dev] Questions about Raster Attribute Tables

Even Rouault even.rouault at spatialys.com
Thu Oct 4 04:24:35 PDT 2018


Mikael,

> It would seem that the .aux.xml format was designed by GDAL developers,
> although I haven't found any documentation on the history of the format.
> Esri documentation says: "ArcGIS 9.2 introduced the AUX.XML file for
> certain file formats", which can be understood as saying the format was
> invented by Esri, but I suspect they really mean something like "ArcGIS 9.2
> adopted the AUX.XML format that was introduced by GDAL Library...".  Any
> comments on that?

Yes, as ArcGIS 9.2 uses partly GDAL, that must be that understanding. We 
cannot exclude that they made custom changes to the upstream GDAL .aux.xml 
format, but I haven't heard about that.

> 
> The files named Filename.aux are a mystery to me.

The .aux files handled by GDAL are in the ERDAS Imagine format

> 
> A) GDAL Library always assumes that fields tagged as RED, GREEN and BLUE
> contain integers.
[...]
>     // color columns should be int 0..255
>     if( ( eFieldUsage == GFU_Red ) || ( eFieldUsage == GFU_Green ) ||
>         ( eFieldUsage == GFU_Blue ) || ( eFieldUsage == GFU_Alpha ) )
>     {
>         eFieldType = GFT_Integer;
>     }
> 
> in the method GDALDefaultRasterAttributeTable::CreateColumn() in
> https://github.com/OSGeo/gdal/blob/master/gdal/gcore/gdal_rat.cpp

This comes from this changeset:
https://github.com/OSGeo/gdal/commit/05421b1b8fbcf47bfc0b96fa67256a20241a1a03

So the remapping [0,1] <--> [0,255] should be done by the HFA/Erdas Imagine 
driver. But if the values are stored in a .aux.xml like in your case, that is 
indeed likely inappropriate. Probably that the change to GFT_Integer should be 
moved to the HFA driver itself.

> B) Wrong Usage for the VALUE column.

> I am not sure if it makes sense to make GDAL Library more tolerant for this
> kind of error. I guess it could use a rule of thumb, saying that if nothing
> else in the .aux.xml tells what the special Value field is, and if the
> first or second field is of type integer and is named "VALUE" or "Value" or
> "value", then that is the special Value field. But maybe such guesswork is
> just ugly.
> 
Yes, that sounds very ad-hoc for this specific case...

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list