Opened 3 years ago

Closed 3 years ago

#5362 closed defect (fixed)

Color columns in RAT not being read as integers with HFA

Reported by: gillins Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

As discussed recently on gdal-dev, the HFA driver reads color columns from the raster attribute table as the type and range they appear in the file which is float 0..1 when written by Imagine.

This is at odds with the IDRISI driver, the Color Table API and comments in the definition of GDALRATFieldUsage in gdal.h. Attached patches (against GDAL trunk) always makes these columns appear as int 0..255 to GDAL but retains reading and writing them to HFA as float 0..1. It also makes it impossible to create color columns as any type other that int. I have taken the opportunity to fix the problem where the alpha column had been called 'Alpha' but in fact Imagine uses the name 'Opacity'.

There was a comment on gdal-dev that this solution could remove precision from the color columns if the number in the HFA file was not precisely N/255. However this is also an issue with the color table API and would take some much larger changes to address and I think is not a major problem for most users.

Attachments (2)

hfadataset.cpp.patch (12.3 KB) - added by gillins 3 years ago.
Patch to hfadataset.cpp against trunk
gdal_rat.cpp.patch (564 bytes) - added by gillins 3 years ago.
Patch to gdal_rat.cpp against trunk

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by gillins

Attachment: hfadataset.cpp.patch added

Patch to hfadataset.cpp against trunk

Changed 3 years ago by gillins

Attachment: gdal_rat.cpp.patch added

Patch to gdal_rat.cpp against trunk

comment:1 Changed 3 years ago by Even Rouault

Resolution: fixed
Status: newclosed

trunk r26870 "HFA: expose color columns in RAT as Integer with values in range [0-255] instead of Real with values [0-1] (#5362, patch by Sam Gillingham)"

Note: See TracTickets for help on using tickets.