Opened 19 years ago

Last modified 5 years ago

#819 closed enhancement

add support for the ClassNames in hfa driver — at Version 5

Reported by: route@… Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: GDAL_Raster Version: unspecified
Severity: minor Keywords:
Cc: Markus Neteler, oschrammen@…

Description (last modified by Markus Neteler)

I've made some modification to the HFA driver for handling the class names 
stored into the img files
the modified files are (from gdal-cvs-20050404)
hfa.h line 207
hfadataset.cpp lines 190,488,508,650-714,736,995,1082-1088

Change History (7)

by route@…, 19 years ago

Attachment: hfa.h added

hfa.h

by route@…, 19 years ago

Attachment: hfadataset.cpp added

hfadataset.cpp

comment:1 by route@…, 19 years ago

Oh, I've seen that it was already registered as #792 !

comment:2 by warmerdam, 19 years ago

This implementation does not seem to work with the test file I have at:

  http://home.gdal.org/~warmerda/classnames.img

However, it does work with another file I have received from ESRI.  

This patch does not provide any mechanism to write category names to newly
created files. 

After review of the patch, it seems to duplicate work that I want to do 
as part of my descriptor table effort, so instead of applying it I think
I will leave this bug report open as a reminder to myself to return category
names when I do the descriptor table work. 

comment:3 by warmerdam, 19 years ago

*** Bug 792 has been marked as a duplicate of this bug. ***

comment:4 by neteler@…, 18 years ago

Frank,

I'm interested to transfer attributes to HFA, e.g. from BSQ.
While RAT support seems to be implemented in HFA, the
attributes do not arrive:

gdalinfo gl-latlong-1km-landcover.bsq
Driver: ENVI/ENVI .hdr Labelled
Size is 43200, 21600
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AXIS["Lat",NORTH],
    AXIS["Long",EAST],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0'0.00"W, 90d 0'0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0'0.00"E, 90d 0'0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00"E, 90d 0'0.00"S)
Center      (  -0.0000000,   0.0000000) (  0d 0'0.00"W,  0d 0'0.00"N)
Band 1 Block=43200x1 Type=Byte, ColorInterp=Palette
  Description = global land cover file 1km
  Categories:
      0: Water_and_Goode_s_interrupted_space
      1: Evergreen_Needleleaf_Forest
      2: Evergreen_Broadleaf_Forest
      3: Deciduous_Needleleaf_Forest
      4: Deciduous_Broadleaf_Forest
      5: Mixed_Forest
      6: Woodland
      7: Wooded_Grassland
      8: Closed_Shrubland
      9: Open_Shrubland
     10: Grassland
     11: Cropland
     12: Bare_Ground
     13: Urban_and_Built-up
  Color Table (RGB with 14 entries)
    0: 0,0,0,255
    1: 1,100,0,255
    2: 1,130,0,255
    3: 151,191,71,255
    4: 2,220,0,255
    5: 0,255,0,255
    6: 146,174,47,255
    7: 220,206,0,255
    8: 255,173,0,255
    9: 255,251,195,255
   10: 140,72,9,255
   11: 247,165,255,255
   12: 255,199,174,255
   13: 0,255,255,255

gdal_translate -of HFA gl-latlong-1km-landcover.bsq gl-latlong-1km-landcover.img

gdalinfo gl-latlong-1km-landcover.img
Driver: HFA/Erdas Imagine Images (.img)
Size is 43200, 21600
Coordinate System is:
GEOGCS["WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235629972],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.00833333,-0.00833333)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0'0.00"W, 90d 0'0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0'0.00"E, 90d 0'0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00"E, 90d 0'0.00"S)
Center      (  -0.0000000,   0.0000000) (  0d 0'0.00"W,  0d 0'0.00"N)
Band 1 Block=64x64 Type=Byte, ColorInterp=Palette
  Description = Layer_1
Metadata:
  LAYER_TYPE=thematic
  Color Table (RGB with 14 entries)
    0: 0,0,0,255
    1: 0,99,0,255
    2: 0,129,0,255
    3: 151,191,71,255
    4: 1,220,0,255
    5: 0,255,0,255
    6: 145,174,47,255
    7: 220,206,0,255
    8: 255,173,0,255
    9: 255,250,194,255
   10: 140,71,8,255
   11: 247,165,255,255
   12: 255,199,174,255
   13: 0,255,255,255

I am not sure if they should or if support is not yet completed.
In the long run we would like to transfer GRASS raster attributes (category
labels) to HFA files.

Best regards

 Markus Neteler

comment:5 by Markus Neteler, 16 years ago

Cc: Markus Neteler added; neteler@… removed
Description: modified (diff)
Note: See TracTickets for help on using tickets.