2

I'm trying to create a raster with signed float values as the pixel values and display the results in MapWindow on windows.

What is the proper gdal band type to use? I've tried both gdal.GDT_Byte and gdal.GDT_Float32 and using both methods I can't seem to get the pixels displayed. If I change the pixel value to the abs() value they will display.

dataset = driver.Create(filename, cols, rows, number_of_bands, gdal.GDT_Byte)

gdal.GDT_CFloat32 allows for negative numbers but doesn't properly display the floating point value past the point.

asked Apr 25, 2012 at 9:34
3
  • 1
    There's something strange about this question, because there is no such thing as an unsigned float, afaik. I wonder what kind of values you really are trying to store in this raster? Commented May 23, 2012 at 21:22
  • I too want to store DEM data as plain headerless binary float32. I'm using a workaround, but I'm surprised GDAL can't handle plain old binary format. Commented Nov 29, 2012 at 8:52
  • Please describe this workaround, so others may benefit from it. Commented Nov 29, 2012 at 10:13

1 Answer 1

3

gdal.GDT_Byte is 8 bit unsigned (0-255). You don't want that. You want gdal.GDT_Float32. If you can't see the result, try calculating statistics - dataset.ComputeStatistics(0) - before displaying.

answered Feb 27, 2013 at 23:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.