[gdal-dev] Identity affine handling in GDALCreateGenImgProjTransformer2

Sandro Santilli strk at keybit.net
Mon Sep 1 04:16:38 PDT 2014


Hi all,
I'm trying to cleanup the PostGIS raster code handling raster warping
and got suprised by the complex code used there to do what looks like
being a workaround for a GDAL bug.

The workaround adds some permutations to rasters with an affine transform
of {0,1,0,0,0,-1}. Looking at the GDAL code I've found that on the code
path used by postgis raster we have a call to GDALCreateGenImgProjTransformer2
which indeed handles in a special case both {0,1,0,0,0,-1} and {0,1,0,0,0,1}
as you can see here: https://github.com/OSGeo/gdal/blob/1.11/gdal/alg/gdaltransformer.cpp#L1163-L1168

Basically it looks like the code doesn't not trust the return code
from the driver's GDALGetGeoTransform() call, but rather look at the
returned matrix to decide if the raster did have or not a an affine
transformation.

The error message I get when passing rasters with that affine to the
function is indeed:

 ERROR 1: Unable to compute a transformation between pixel/line
 and georeferenced coordinates for .
 There is no affine transformation and no GCPs.

But the raster _does_ have an affine transformation, just happens to
be the identity one.

Should the GDALCreateGenImgProjTransformer2 not threat the identity matrix
in a special way ?

--strk;

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the gdal-dev mailing list