[gdal-dev] SRTM/hgt to TIFF with alpha

David dbainbridge at gmail.com
Thu Apr 8 00:08:58 EDT 2010

Hello.  I  am having a terrible time trying to figure out how to convert what should be value/height of 0 in the SRTM/hgt data file to the alpha layer in a tiff.  I was experimenting with making ocean areas transparent.  I tried the following with no success:

gdalwarp -of GTiff -co "TILED=YES"  -dstalpha -srcnodata 0 -wt Float32 -ot Float32 -wo SAMPLE_STEPS=100 -multi N40W125.hgt test.tiff

gdalinfo -mm gives:
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
    Computed Min/Max=-32768.000,1233.000
Band 2 Block=256x256 Type=Float32, ColorInterp=Alpha
    Computed Min/Max=0.000,255.000

Since this may affect the hillshading for any land areas inland I was also going to attempt the same affect by masking the ocean after the hillshading.

The resulting tiff in either case would be overlaid onto another layer that would have any land areas filled in with the resulting color that would have been used with height 0 in the hgt file.  I am doing this because I have a coastline shapefile that represents land areas but not ocean areas.

Is my approach a good idea and/or what am I missing to mask the ocean areas into the alpha layer?
Thanks for any help.

More information about the gdal-dev mailing list