[gdal-dev] How to publish null as nodata by gdalwarp?

OHTSUKA Ko-hei kochizufan at gmail.com
Sun Sep 16 22:12:24 PDT 2012


Hello,

I have a GeoTiff DEM, which is written in WGS84 and describes nodata as null.
(No data means sea area.)

I want to make shaded-color-relief tiff in spherical mercator from it, so I run:

gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3785 -r bilinear wgs_dem.tif merc_dem.tif
gdaldem color-relief -alpha -co ALPHA=YES merc_dem.tif ramp.txt merc_rel.tif
gdaldem hillshade -compute_edges merc_dem.tif melc_shd.tiff
hsv_merge.py merc_rel.tif melc_shd.tiff melc_shdrel.tiff

But, result file melc_shdrel.tiff not contains null data.
null data are all changed into value 0, so they are not transparent,
and colored as ground.


I tried several change to command, consequently,

gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3785 -srcnodata "" -r bilinear
wgs_dem.tif merc_dem.tif

This command makes null data not to value 0 but to -9999.
"gdaldem color-relief" detect this change and make sea area as transparent.
But, "gdaldem hillshade" not detect this, so sea shore shown as huge
cliff, and sea area became
gray.

I tried '--dstnodata' or '-dstalpha' option, but they makes any good change.


Is there any ways to get destination data which describes null as
nodata in gdalwarp?

Or, making "gdaldem hillshade" to detect -9999 as nodata?


Regards,

OHTSUKA Ko-hei


More information about the gdal-dev mailing list