[gdal-dev] Cannot set simple geotransform

Even Rouault even.rouault at spatialys.com
Wed Feb 5 10:31:11 PST 2020


> It's a known bug. There is some analysis at
> https://github.com/mapbox/rasterio/issues/524#issuecomment-156655258.

Actually, is a *past* known bug, at least for the GTiff driver

>From GDAL 2.3.0 news:
 * make it accept to write SetGeoTransform([0,1,0,0,0,1]) as a 
ModelTransformationTag, and remove particular cases with the [0,1,0,0,0,1] 
geotransform (#1683)

This fix also fixes (0,1,0,0,0,-1)

>>> from osgeo import gdal
ds=gdal.GetDriverByName('GTiff').Create('/tmp/test.tif',5,5,1,gdal.GDT_Byte)     
>>> ds=gdal.GetDriverByName('GTiff').Create('/tmp/test.tif',
5,5,1,gdal.GDT_Byte)     
>>> ds.GetGeoTransform()     
(0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
>>> ds.SetGeoTransform((0,1,0,0,0,-1))                 
0
>>> del ds           
>>> ds=gdal.OpenEx('/tmp/test.tif',gdal.GA_Update)    
>>> ds.GetGeoTransform()             
(0.0, 1.0, 0.0, 0.0, 0.0, -1.0)
>>> 


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list