I am working on a GDAL driver for a proprietary grid-format. In some cases, the grids are rotated in order to get smaller file sizes. In my GDAL geotransform array, I do the following (showing a hardcoded 30 degrees angle):

rot_deg = 30;
rotation = rot_deg * deg2rad;
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;

where originX and originY is the center of the corner cell.

In addition, I got an identical file in TIFF format, with same min/max + cell values.I then apply an ArcGis geotransform to the .tiff, rotating it 30 degrees aswell.

When adding both files as layers, the tiff is 100% correctly aligned to the pivot point, while my GDAL format is slightly displaced.

The screenshot shows the overlapping grids, with only the corner pixel visible. The cyan point is the pivot point. The dark pixel on top is the (correct) tiff, while the grey pixel beneath is from my own driver. The misalignment is the same over the whole grid.

Anybody got an idea what could be wrong ?

enter image description here

In the ArcGis geotransform, it is possible to enter a pivot point, which is the case here (center of the corner cell). However, it seems like GDAL's geotransform is not expressive enough (?) to handle this, hence it uses the lower left corner.


1 Answer 1


The GDAL geotransform matrix lacks the possibility to shift x/y directions (only scaling and rotation can be done).

The solution was to create a custom geomtransform in ArcObjects, which adds additional transformation parameters to the aux.xml file. The grid then rotated/shifted/scaled as dersired.

Unfortunately, I don't have access to the code anymore, and can't provide sample code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.