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

Michal Migurski mike at stamen.com
Mon May 16 13:44:15 EDT 2011


Hi Chatinya,

Thanks for the advice - I've definitely ensured that the file does not exist first, cleared it out and re-ran gdal_merge.py. The result still has the same clipping to 255.

-mike.

On May 15, 2011, at 9:19 PM, Chaitanya kumar CH wrote:

> Michal,
> 
> Check if the output file already exists. The script won't create a new one if it already exists.
> 
> On Mon, May 16, 2011 at 12:45 AM, Michal Migurski <mike at stamen.com> wrote:
> 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
> 
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 
> 
> -- 
> Best regards,
> Chaitanya kumar CH.
> /tʃaɪθənjə/ /kʊmɑr/ 
> +91-9494447584
> 17.2416N 80.1426E

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





More information about the gdal-dev mailing list