[gdal-dev] Question about GDALDataType::GDT_Float32

Frank Warmerdam warmerdam at pobox.com
Fri Jul 10 17:28:36 EDT 2009


Adeel Raza wrote:
> Hi,
> 
> I'm using the GDALRasterBand::RasterIO() function to write a buffer of 
> C/C++ float types to a raster band of data type 
> GDALDataType::GDT_Float32. I assumed that this conversion would not be 
> problem since the size of a C/C++ float is also 32 bits, but I wanted to 
> be sure. If the conversion will be problematic, how would I resolve the 
> issue (ex: a potential cast maybe).

Adeel,

There is no problem.  The GDT_Float32 enumeration value refers to the
normal 32bit system "float" type in C/C++.

I would add that you should expect, and provide float's in native
machine order.  GDAL will take care of byte swapping during io if
needed.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list