[gdal-dev] Geotransform - rotation and translation

Oyvind Idland oyvind.idland at gmail.com
Mon Aug 26 09:50:26 PDT 2013


I am currently working on a driver for a proprietary format, which is being
consumed by ArcGis via GDAL.

These grids sometimes has a rotation with a specified pivot point. I
managed to get ArcGis to display the rotated grid by doing the following:

poDS->dGeoTransform[0] = originX;
poDS->dGeoTransform[1] = cos(rotation) * cellSizeX;
poDS->dGeoTransform[2] = -sin(rotation) * cellSizeX;
poDS->dGeoTransform[3] = originY;
poDS->dGeoTransform[4] = sin(rotation) * cellSizeY;
poDS->dGeoTransform[5] = cos(rotation) * cellSizeY;

Rotation is in radians. It works, but there is one problem: I need to
rotate the grid around the center of the corner cell (originX, originY),
but ends up getting rotation around the corner of the cell/raster instead.

There is a screenshot here, showing only the corner pixel. The topmost
grid/pixel was translated using custom geotransform in ArcGis, the bottom
one is the result of my GDAL rotation:
The cyan dot shows the pivot point:

http://i.stack.imgur.com/7HEvc.png


Is there any way to express this translation using the geotransform matrix ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130826/bd52190f/attachment.html>


More information about the gdal-dev mailing list