[gdal-dev] Re: no date value by gdal_merge from DEM to GTiff ?
Hermann Peifer
peifer at gmx.eu
Sun Dec 6 05:13:18 EST 2009
Bruce Liang wrote:
> Hello, guys,
>
> I have several DEMs from USGS GTOPO30, and by merging them with
> gdal_merge.py, it seems the no data value can not be assigned?
>
> the command is like:
> gdal_merge.py -of GTiff -o Europe.tiff -n -9999 -co "PROFILE=GeoTIFF" -co
> "INTERLEAVE=PIXEL" -co "COMPRESS=NONE" -co "TILED=YES" *.DEM
>
> and to check it with "gdalinfo -stats Europe.tiff ", i got:
>
> Band 1 Block=256x256 Type=UInt16, ColorInterp=Gray
> Minimum=1.000, Maximum=65535.000, Mean=30979.953, StdDev=27318.154
> Metadata:
> STATISTICS_MINIMUM=1
> STATISTICS_MAXIMUM=65535
> STATISTICS_MEAN=30979.952856589
> STATISTICS_STDDEV=27318.154016739
>
> seems the no data value is now 65535 ? how to assign it correctly?
No. It seems that your highest *data* value is now 65535 and there isn't any *no data* value defined. According to your GeoTIFF statistics, the average elevation in Europe is around 31000 meters above sea level. Which seems to be a bit too high, as far as I can judge. You might have also noted, that your GeoTIFF type is UInt16, which doesn't allow for negative values. Elevation data can however be negative: a good part of the Netherlands is below sea level, not to talk about the Dead Sea (-422m or so).
Here is what I did the other day in order to merge GTOPO30 data:
gdalwarp -srcnodata -9999 -dstnodata -9999 -co TILED=YES *.DEM outfile.tif
In my case, the resulting GeoTIFF type was Int16 (same type as the *.DEMs), and the statistics are:
Minimum=-405.000, Maximum=5417.000, Mean=359.426, StdDev=456.872
NoData Value=-9999
Metadata:
STATISTICS_MINIMUM=-405
STATISTICS_MAXIMUM=5417
STATISTICS_MEAN=359.42640750109
STATISTICS_STDDEV=456.87166274078
gdal_merge.py is an example Python script and I am not quite sure what its advantage is over gdalwarp. FrankW could perhaps shed some light on this issue.
Hermann
More information about the gdal-dev
mailing list