[GIS] Remove Color Attribute Table – GDAL – geoTiff

gdalgeotiff-tiff

How can I remove the GDALRasterAttributeTable with GDAL? It interferes with styling in Geoserver.

GDALInfo output below:

Driver: GTiff/GeoTIFF
Files: gcev3-product1-cropland-extent-australia.tif
       gcev3-product1-cropland-extent-australia.tif.aux.xml
Size is 155316, 125062
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (112.509138433435837,-10.116018245998344)
Pixel Size = (0.000269494585236,-0.000269494585236)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 112.5091384, -10.1160182) (112d30'32.90"E, 10d 6'57.67"S)
Lower Left  ( 112.5091384, -43.8195501) (112d30'32.90"E, 43d49'10.38"S)
Upper Right ( 154.3659594, -10.1160182) (154d21'57.45"E, 10d 6'57.67"S)
Lower Right ( 154.3659594, -43.8195501) (154d21'57.45"E, 43d49'10.38"S)
Center      ( 133.4375489, -26.9677842) (133d26'15.18"E, 26d58' 4.02"S)
Band 1 Block=155316x1 Type=Byte, ColorInterp=Palette
  Description = Layer_1
  Min=0.000 Max=3.000 
  Minimum=0.000, Maximum=3.000, Mean=1.411, StdDev=1.467
  Metadata:
    LAYER_TYPE=thematic
    STATISTICS_HISTOBINVALUES=-2147483648|463732937|403592142|-2147483648|
    STATISTICS_HISTOMAX=3
    STATISTICS_HISTOMIN=0
    STATISTICS_HISTONUMBINS=4
    STATISTICS_MAXIMUM=3
    STATISTICS_MEAN=1.4106150300956
    STATISTICS_MEDIAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_MODE=0
    STATISTICS_SKIPFACTORX=1
    STATISTICS_SKIPFACTORY=1
    STATISTICS_STDDEV=1.4672104301177
  Image Structure Metadata:
    NBITS=2
  Color Table (RGB with 4 entries)
    0: 0,0,0,255
    1: 255,255,0,255
    2: 0,255,255,255
    3: 46,48,71,255
<GDALRasterAttributeTable Row0Min="0" BinSize="1">
  <FieldDefn index="0">
    <Name>Histogram</Name>
    <Type>1</Type>
    <Usage>1</Usage>
  </FieldDefn>
  <FieldDefn index="1">
    <Name>Red</Name>
    <Type>0</Type>
    <Usage>6</Usage>
  </FieldDefn>
  <FieldDefn index="2">
    <Name>Green</Name>
    <Type>0</Type>
    <Usage>7</Usage>
  </FieldDefn>
  <FieldDefn index="3">
    <Name>Blue</Name>
    <Type>0</Type>
    <Usage>8</Usage>
  </FieldDefn>
  <FieldDefn index="4">
    <Name>Opacity</Name>
    <Type>0</Type>
    <Usage>9</Usage>
  </FieldDefn>
  <FieldDefn index="5">
    <Name>Class_Names</Name>
    <Type>2</Type>
    <Usage>2</Usage>
  </FieldDefn>
  <Row index="0">
    <F>9847120537</F>
    <F>0</F>
    <F>0</F>
    <F>0</F>
    <F>0</F>
    <F></F>
  </Row>
  <Row index="1">
    <F>463732937</F>
    <F>255</F>
    <F>255</F>
    <F>0</F>
    <F>255</F>
    <F>1. Croplands</F>
  </Row>
  <Row index="2">
    <F>403592142</F>
    <F>0</F>
    <F>255</F>
    <F>255</F>
    <F>255</F>
    <F>2. Pastures</F>
  </Row>
  <Row index="3">
    <F>8709683976</F>
    <F>46</F>
    <F>48</F>
    <F>71</F>
    <F>255</F>
    <F>3. Non croplands</F>
  </Row>
</GDALRasterAttributeTable>

Best Answer

My solution was to run a /usr/bin/gdal_calc.py -A input.tif --outfile=output.tif --calc="A*1" --NoDataValue=0 --co="compress=lzw"

Related Question