Opened 15 years ago

Closed 8 months ago

#819 closed enhancement (wontfix)

add support for the ClassNames in hfa driver

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

Attachments (2)

hfa.h (11.7 KB) - added by route@… 15 years ago.
hfa.h
hfadataset.cpp (85.2 KB) - added by route@… 15 years ago.
hfadataset.cpp

Download all attachments as: .zip

Change History (11)

Changed 15 years ago by route@…

Attachment: hfa.h added

hfa.h

Changed 15 years ago by route@…

Attachment: hfadataset.cpp added

hfadataset.cpp

comment:1 Changed 15 years ago by route@…

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

comment:2 Changed 15 years ago by warmerdam

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 Changed 15 years ago by warmerdam

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

comment:4 Changed 14 years ago by neteler@…

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 Changed 12 years ago by Markus Neteler

Cc: Markus Neteler added; neteler@… removed
Description: modified (diff)

comment:6 Changed 5 years ago by Jukka Rahkonen

Is this perhaps implemented in some alternative way together with the original or enhanced RAT support http://trac.osgeo.org/gdal/wiki/rfc40_enhanced_rat_support?

comment:7 Changed 5 years ago by Jukka Rahkonen

GDAL NEWS for 1.3.1 http://svn.osgeo.org/gdal/trunk/gdal/NEWS announce:

Raster Attribute Tables:

  • Implemented new Raster Attribute Tables support. See the GDALRasterAttributeTable class for more information.

Documentation of GDALRasterAttributeTable class gives this information:

Each column in a raster attribute table has a name, a type (integer, 
floating point or string), and a GDALRATFieldUsage. The usage 
distinguishes columns with particular understood purposes (such as 
color, histogram count, name) and columns that have specific 
purposes not understood by the library (long label, 
suitability_for_growing_wheat, etc).

I could not easily find any HFA file including class names and therefore I do not close this issue yet even it does feel resolved.

comment:8 Changed 4 years ago by Even Rouault

Priority: highnormal

All those tickets have more than one year and nobody has acted on it, so the priority is not so high

comment:9 Changed 8 months ago by Even Rouault

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: assignedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub?. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.