[gdal-dev] Re: no date value by gdal_merge from DEM to GTiff ?
Bruce Liang
bruce.h.liang at gmail.com
Sun Dec 6 06:53:54 EST 2009
Thank you Herrmann,
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.
the info of the original DEM (e.g. E020N40.DEM) is :
Band 1 Block=4800x1 Type=UInt16, ColorInterp=Undefined
Min=-9999.000 Max=5825.000
Minimum=-9999.000, Maximum=5825.000, Mean=-2347.600, StdDev=4873.500
NoData Value=-9999
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.
Problem has been solved, by explicitly adding "PIXELTYPE SIGNEDINT" in the
.HDR files, and the result is now correct.
On Sun, Dec 6, 2009 at 11:13 AM, Hermann Peifer <peifer at gmx.eu> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20091206/ac46c209/attachment-0001.html
More information about the gdal-dev
mailing list