[gdal-dev] How is NODATA interperted with a color table?

Stephen Woodbridge woodbri at swoodbridge.com
Wed Jun 24 18:49:39 PDT 2015


I have a geotiff  with one band of byte with a color table, but it does 
not have NODATA set in it. How would I set it NODATA to be to be entry 0 
in the color table.

$ gdalinfo A2015173174000.L0_LAC.L2_OC.tif
Driver: GTiff/GeoTIFF
Files: A2015173174000.L0_LAC.L2_OC.tif
Size is 2433, 1727
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 = (-84.000000000000000,45.000000000000000)
Pixel Size = (0.012741471640766,-0.012738853693008)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -84.0000000,  45.0000000) ( 84d 0' 0.00"W, 45d 0' 0.00"N)
Lower Left  ( -84.0000000,  22.9999997) ( 84d 0' 0.00"W, 23d 0' 0.00"N)
Upper Right ( -52.9999995,  45.0000000) ( 53d 0' 0.00"W, 45d 0' 0.00"N)
Lower Right ( -52.9999995,  22.9999997) ( 53d 0' 0.00"W, 23d 0' 0.00"N)
Center      ( -68.4999997,  33.9999998) ( 68d30' 0.00"W, 34d 0' 0.00"N)
Band 1 Block=2433x3 Type=Byte, ColorInterp=Palette
   Color Table (RGB with 256 entries)
     0: 147,0,108,255
     ...
   255: 0,0,0,255

I tried the following:

$ gdal_translate -a_nodata 0 -co TILED=YES A2015173174000.L0_LAC.tif 
test-tc.tif
Input file size is 2433, 1727
0...10...20...30...40...50...60...70...80...90...100 - done.
[] ~/work/oceandata/test$ gdalinfo test-tc.tif
Driver: GTiff/GeoTIFF
Files: test-tc.tif
Size is 2433, 1727
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 = (-84.000000000000000,45.000000000000000)
Pixel Size = (0.012741471640766,-0.012738853693008)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( -84.0000000,  45.0000000) ( 84d 0' 0.00"W, 45d 0' 0.00"N)
Lower Left  ( -84.0000000,  22.9999997) ( 84d 0' 0.00"W, 23d 0' 0.00"N)
Upper Right ( -52.9999995,  45.0000000) ( 53d 0' 0.00"W, 45d 0' 0.00"N)
Lower Right ( -52.9999995,  22.9999997) ( 53d 0' 0.00"W, 23d 0' 0.00"N)
Center      ( -68.4999997,  33.9999998) ( 68d30' 0.00"W, 34d 0' 0.00"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
   NoData Value=0
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
   NoData Value=0
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
   NoData Value=0

But that does not look correct, so I'm checking. Also I don't see any 
note that the tif is TILED?

Thanks,
   -Steve


More information about the gdal-dev mailing list