[gdal-dev] How to consider data types when implementing IWriteBlock
jramm
jamessramm at gmail.com
Tue Apr 12 08:10:41 PDT 2016
Hi
I am adding write support for the Northwood Grid (Vertical Mapper/MapInfo
format) driver.
This format only allows 32 bit float as the datatype, and to make things
more tricky it actually stores this on disk as either 16 or 32 bit ints,
using scaling rules.
The current read driver applies the scaling to each pixel when reading, to
return a buffer of 32 bit floats and I look to do the reverse when writing.
When implementing `WriteBlock`, is it OK to assume that pImage will always
be of the correct type? (float 32). I've noticed in debugging using
gdal_translate that if I dont specify the output data type, it carries on
and passes the source buffer (which is not float 32) to IWriteBlock of the
destination.
Given that only allowing 32bit floats is quite restrictive, should I:
- raise an error in the `Create` method if the data type isnt GDT_Float32
- Attempt to handle all gdal data type in IWriteBlock by storing the user
requested data type in some variable (poDS->eUserDataType) and then using
GDALCopyWords within IWriteBlock to first copy pImage to a buffer of 32 bit
floats before proceeding?
Thanks
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-consider-data-types-when-implementing-IWriteBlock-tp5260901.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list