[gdal-dev] RawRasterBand and rotated images ?

Andrew C Aitchison gdal at aitchison.me.uk
Mon Feb 2 04:01:08 PST 2015


I'm preparing to write a readonly driver for a file format where the image 
is an array of bytes, so the RawRasterBand helper class seems appropriate.
However the image data starts at the bottom left and each scanline goes 
up; viewing the data in the conventional (for gdal) manner gives west at 
the top.

I see two possible ways around this with RawRasterBand:

1) apply a rotation in the geotransform matrix; or

2) abuse the pixel and line offsets to rotate the data on the fly,
so that we actually read the pixel values in the standard order
but successive memory accesses are a row apart
(I see that ctable2dataset.cpp, gtxdataset.cpp and 
loslasdataset.cpp use a similar trick to reflect on the fly
but don't see any "raw" drivers that rotate).

The files are small; less than a megabyte and under 1000x1000 pixels.

Both methods risk making a mess of any memory caching, but one passes the 
problem up to the application and two passes it down to the RawRasterBand 
implementation.

Does anyone have advice on whether either of these is OK,
or should I write the driver without the RawRasterBand helper class ?

Thanks,

Andrew C Aitchison


More information about the gdal-dev mailing list