[gdal-dev] gdaldem color-relief geotiff alpha band nv value not working

Hailey Eckstrand haileyeckstrand at gmail.com
Thu Nov 17 15:48:52 EST 2011


Hi All,

I am trying to create an RGBA geotiff using gdaldem color-relief. When I
load the output geotiff into QGIS, all the NoData values appear black, so I
loaded the geotiff into R (using rgdal) and all the values in the the alpha
band are 255, none are 0.
What am I doing wrong? Thanks in advance,
Hailey

Here are my steps:

$ gdaldem color-relief test.tif colors.txt test2.tif -alpha -co ALPHA=YES

where colors.txt:

6010    255     255     255     255
2700    247     229     200     255
2200    224     192     164     255
2000    150     101     48      255
1800    168     134     64      255
1600    204     170     102     255
1400    219     198     129     255
1200    206     206     126     255
1000    168     186     114     255
750     130     157     85      255
500     105     134     79      255
300     82      120     71      255
0       82      120     71      255
nv      0       0       0       0


$ gdalinfo test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 8545, 6741
Coordinate System is:
PROJCS["NAD_1983_CSRS_BC_Environment_Albers",
    GEOGCS["GCS_North_American_1983_CSRS",
        DATUM["North_American_1983_CSRS",
            SPHEROID["GRS_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Albers_Conic_Equal_Area"],
    PARAMETER["standard_parallel_1",50],
    PARAMETER["standard_parallel_2",58.5],
    PARAMETER["latitude_of_center",45],
    PARAMETER["longitude_of_center",-126],
    PARAMETER["false_easting",1000000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-3267710.539297561161220,4568786.377016356214881)
Pixel Size = (758.984955600446028,-758.984955600446028)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-3267710.539, 4568786.377) (140d 2'31.59"E, 56d 4'47.55"N)
Lower Left  (-3267710.539, -547531.209) (168d48' 5.40"W, 27d27'32.14"N)
Upper Right ( 3217815.906, 4568786.377) ( 46d22'30.99"W, 74d 3'20.87"N)
Lower Right ( 3217815.906, -547531.209) (101d35'47.90"W, 36d25'26.60"N)
Center      (  -24947.316, 2010627.584) (145d32'21.90"W, 61d48' 4.50"N)
Band 1 Block=8545x1 Type=Int32, ColorInterp=Gray
  Min=1.000 Max=6009.000
  Minimum=1.000, Maximum=6009.000, Mean=757.173, StdDev=613.626
  NoData Value=-9999
  Metadata:
    STATISTICS_MAXIMUM=6009
    STATISTICS_MEAN=757.17319855878
    STATISTICS_MINIMUM=1
    STATISTICS_STDDEV=613.62557570411



$ gdalinfo test2.tif
Driver: GTiff/GeoTIFF
Files: test2.tif
Size is 8545, 6741
Coordinate System is:
PROJCS["NAD_1983_CSRS_BC_Environment_Albers",
    GEOGCS["GCS_North_American_1983_CSRS",
        DATUM["North_American_1983_CSRS",
            SPHEROID["GRS_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Albers_Conic_Equal_Area"],
    PARAMETER["standard_parallel_1",50],
    PARAMETER["standard_parallel_2",58.5],
    PARAMETER["latitude_of_center",45],
    PARAMETER["longitude_of_center",-126],
    PARAMETER["false_easting",1000000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-3267710.539297561161220,4568786.377016356214881)
Pixel Size = (758.984955600446028,-758.984955600446028)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-3267710.539, 4568786.377) (140d 2'31.59"E, 56d 4'47.55"N)
Lower Left  (-3267710.539, -547531.209) (168d48' 5.40"W, 27d27'32.14"N)
Upper Right ( 3217815.906, 4568786.377) ( 46d22'30.99"W, 74d 3'20.87"N)
Lower Right ( 3217815.906, -547531.209) (101d35'47.90"W, 36d25'26.60"N)
Center      (  -24947.316, 2010627.584) (145d32'21.90"W, 61d48' 4.50"N)
Band 1 Block=8545x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=8545x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=8545x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=8545x1 Type=Byte, ColorInterp=Alpha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111117/87df45e1/attachment-0001.html


More information about the gdal-dev mailing list