Opened 18 years ago

Last modified 13 years ago

#999 closed enhancement

added ability to write Raster Attribute Tables to hfa format — at Version 1

Reported by: robert.denham@… Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: GDAL_Raster Version: unspecified
Severity: minor Keywords: HFA
Cc: Markus Neteler

Description (last modified by rdenham)

Modified hfadataset.cpp so that it is possible to write a RAT to an HFA image. 
The function WriteNamedRAT does the work, and is based on ReadNamedRAT.

You can now use:
  GDALSetDefaultRAT(band,rat);
to save a rat to an HFA images.

Frank there are a couple of things that we weren't sure about in the behaviour
of this.  For example, if you create 2 RAT's, and call 

  GDALSetDefaultRAT(band,rat1);
  GDALSetDefaultRAT(band,rat2);

then in the image the rats are concatenated, rather than rat2 overwriting rat1.
 We weren't sure whether this is what would be expected, but it seemed more
difficult to remove a RAT so we left it.  

GDALRATInitializeFromColorTable also produced some results that might be
unexpected.  If you use GDALRATInitializeFromColorTable to set up the rat, then
save it to an image with a colour table, when looking at the RAT from Imagine
you will see duplicate columns for each colour.  It seems that Imagine
automatically concatenates the colour table to the RAT.

One final thing, is there any chance of python bindings for the RAT stuff?

Robert

Change History (4)

by robert.denham@…, 18 years ago

Attachment: hfadataset.cpp.patch added

patch for hfdataset.cpp to allow writing of RAT's

by rdenham, 13 years ago

Attachment: hfadataset.cpp.1.7.3.patch added

Patch to add ability to create raster attribute tables for HFA format. Updated for 1.7.3

comment:1 by rdenham, 13 years ago

Description: modified (diff)

by Sam Gillingham, 13 years ago

Attachment: hfadataset.cpp.1.8.0.patch added

Updated for GDAL 1.8.0

Note: See TracTickets for help on using tickets.