Ticket #999 (closed enhancement: fixed)

Opened 8 years ago

Last modified 2 years ago

added ability to write Raster Attribute Tables to hfa format

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

Description (last modified by rdenham) (diff)

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

Attachments

hfadataset.cpp.patch Download (6.4 KB) - added by robert.denham@… 8 years ago.
patch for hfdataset.cpp to allow writing of RAT's
hfadataset.cpp.1.7.3.patch Download (8.4 KB) - added by rdenham 2 years ago.
Patch to add ability to create raster attribute tables for HFA format. Updated for 1.7.3
hfadataset.cpp.1.8.0.patch Download (8.4 KB) - added by gillins 2 years ago.
Updated for GDAL 1.8.0

Change History

Changed 8 years ago by robert.denham@…

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

Changed 2 years ago by rdenham

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

Changed 2 years ago by rdenham

  • description modified (diff)

Changed 2 years ago by gillins

Updated for GDAL 1.8.0

Changed 2 years ago by gillins

This patch has been used operationally for approx. 5 years by the Queensland Dept. of Environment and Resource Management (Australia) without any problems. We are pretty keen to get this accepted into the mainline and would appreciate any suggestions to help us do so.

We note that the IDRISI driver also supports writing of RATs and the Python bindings for this functionality also exist.

The issues mentioned in the original report we think are reasonable limitations given the HFA implementation of RAT's and Imagine's treatment of them.

Any thoughts on what needs to be done to this patch to have it accepted?

Changed 2 years ago by warmerdam

  • keywords HFA added
  • priority changed from high to normal
  • status changed from new to assigned
  • milestone set to 1.9.0

Sam,

I'm a reviewing and will apply it in trunk unless I run into serious problems.

Changed 2 years ago by warmerdam

  • status changed from assigned to closed
  • resolution set to fixed

I have applied the patch in trunk (r21657). I note that WriteNamedRAT() does not support writing the unique valued binning function which comes up in the small test case.

Thanks and sorry for the lengthy delay in applying this patch. I'm very chicken about changes to the hfa driver.

Changed 2 years ago by rouault

r21658 /trunk/gdal/frmts/hfa/hfadataset.cpp: fix memory leak (#999)

Note: See TracTickets for help on using tickets.