<br>Thank you Herrmann,<div>yes, the problem is about the data type. looks like your GTOPO30 data is a little different from mine. If I run your command, the result tiff will still be UInt16, and the largest data value is 65535, with NoDate=-9999.</div>
<div> </div><div>the info of the original DEM (e.g. E020N40.DEM) is :</div><div>Band 1 Block=4800x1 Type=UInt16, ColorInterp=Undefined</div><div> Min=-9999.000 Max=5825.000</div><div> Minimum=-9999.000, Maximum=5825.000, Mean=-2347.600, StdDev=4873.500</div>
<div> NoData Value=-9999</div><div><br></div><div>it's strange that even type is UInt16, there are still negative values. So either with gdalwarp or gdal_merge.py, the result Tiff will still be UInt16.</div><div>Problem has been solved, by explicitly adding "PIXELTYPE SIGNEDINT" in the .HDR files, and the result is now correct.</div>
<div> </div><div><br></div><div><br><div class="gmail_quote">On Sun, Dec 6, 2009 at 11:13 AM, Hermann Peifer <span dir="ltr"><<a href="mailto:peifer@gmx.eu">peifer@gmx.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">Bruce Liang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello, guys,<br>
<br>
I have several DEMs from USGS GTOPO30, and by merging them with<br>
gdal_merge.py, it seems the no data value can not be assigned?<br>
<br>
the command is like:<br>
gdal_merge.py -of GTiff -o Europe.tiff -n -9999 -co "PROFILE=GeoTIFF" -co<br>
"INTERLEAVE=PIXEL" -co "COMPRESS=NONE" -co "TILED=YES" *.DEM<br>
<br>
and to check it with "gdalinfo -stats Europe.tiff ", i got:<br>
<br>
Band 1 Block=256x256 Type=UInt16, ColorInterp=Gray<br>
Minimum=1.000, Maximum=65535.000, Mean=30979.953, StdDev=27318.154<br>
Metadata:<br>
STATISTICS_MINIMUM=1<br>
STATISTICS_MAXIMUM=65535<br>
STATISTICS_MEAN=30979.952856589<br>
STATISTICS_STDDEV=27318.154016739<br>
<br>
seems the no data value is now 65535 ? how to assign it correctly?<br>
</blockquote>
<br></div></div>
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).<br>
<br>
Here is what I did the other day in order to merge GTOPO30 data:<br>
gdalwarp -srcnodata -9999 -dstnodata -9999 -co TILED=YES *.DEM outfile.tif<br>
<br>
In my case, the resulting GeoTIFF type was Int16 (same type as the *.DEMs), and the statistics are:<br>
<br>
Minimum=-405.000, Maximum=5417.000, Mean=359.426, StdDev=456.872<br>
NoData Value=-9999<br>
Metadata:<br>
STATISTICS_MINIMUM=-405<br>
STATISTICS_MAXIMUM=5417<br>
STATISTICS_MEAN=359.42640750109<br>
STATISTICS_STDDEV=456.87166274078<br>
<br>
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.<br><font color="#888888">
<br>
Hermann<br>
</font></blockquote></div><br></div>