Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

EDIT/update: 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.

share|improve this question
    
Does your EDIT/update mean that you now know the answer to your own question? If so, it is permissible for you to post an Answer and then Accept it. Also, I've assumed that when you refer to ArcGIS Geotransform you are looking at ArcObjects. –  PolyGeo Sep 23 '13 at 7:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.