[gdal-dev] Attempting to merge DEMs with gdal_merge.py - getting Float32 clipped to 255.0

Michal Migurski mike at stamen.com
Sun May 15 15:15:02 EDT 2011


Hello,

I'm attempting to merge a number of DEMs in .flt format using gdal_merge.py. It's NED 1/3 arc second data, so each one is a Float32 10812x10812 raster with a range of values from a few meters below sea level to 1.4km. I'm getting back an image with an incorrect datatype even though I believe that I'm using the right "-ot Float32" parameter to gdal_merge.py. I appear to have gdal 1.5.4 on this machine; I can upgrade to a newer one if necessary but I'd first like to make sure I'm not using the tool incorrectly.

Here's the command I use:

	gdal_merge.py -o 38122.tif -of GTiff -ot Float32 -v -ul_lr -122.05 38.05 -121.95 37.95 10m/*.flt

What I get back is a 1080x1080 GeoTIFF with the correct bounds that I'm expecting, but what appears to be garbage data or perhaps just raw floating point values misinterpreted as bytes. Here's the output showing Byte values instead of Float32 as I'd expect:

	Band 1 Block=1080x7 Type=Byte, ColorInterp=Gray
	  Min=0.000 Max=255.000 
	  Minimum=0.000, Maximum=255.000, Mean=108.657, StdDev=66.615

This is a sample of the resulting image in pseudocolor, showing the vertical banding every 4px that makes me think the bytes are just a raw Float32 stream:

	http://mike.teczno.com/img/38122-rainbow.png

Here is a sample input band:

	Band 1 Block=10812x1 Type=Float32, ColorInterp=Undefined
	    Computed Min/Max=-8.170,1440.937
	  NoData Value=-9999

Am I using -ot incorrectly?

-mike.

----------------------------------------------------------------
michal migurski- mike at stamen.com
                 415.558.1610





More information about the gdal-dev mailing list