<div dir="ltr"><div dir="ltr">Hi Jon,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020 at 10:15 AM Jon Morris <<a href="mailto:Jon.Morris@jbarisk.com">Jon.Morris@jbarisk.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-GB">
<div class="gmail-m_-8315920373161666987WordSection1">
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black">I've just spent most of the afternoon banging my head against the desk because it appears that you cannot set a geotransform of (0, 1, 0, 0, 0, -1). Any other value works fine, but
with this particular GT, the change is not saved when you close the ds. Is this a known issue? I'm using GDAL 2.2.0 on Python 3.6.8.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black">IPython console:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [269]: ds=gdal.GetDriverByName('GTiff').Create('/tmp/test.tif',5,5,1,gdal.GDT_Byte)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [270]: ds.GetGeoTransform()
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">Out[270]: (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [271]: ds.SetGeoTransform((0,1,0,0,0,-1))
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">Out[271]: 0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [272]: del ds <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [273]: ds=gdal.OpenEx('/tmp/test.tif',gdal.GA_Update)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [274]: ds.GetGeoTransform() <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">Out[274]: (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [275]: ds.SetGeoTransform((0,1,0,0,0,-1.000000001))
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">Out[275]: 0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [276]: del ds
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [277]: ds=gdal.OpenEx('/tmp/test.tif',gdal.GA_Update)
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">In [278]: ds.GetGeoTransform()
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">Out[278]: (0.0, 1.0, 0.0, 0.0, 0.0, -1.000000001)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:black">Jon</span></p><p class="MsoNormal"><span style="font-family:Arial,sans-serif;color:rgb(246,161,36)"><u></u></span></p>
</div></div></blockquote></div><div><br></div>It's a known bug. There is some analysis at <a href="https://github.com/mapbox/rasterio/issues/524#issuecomment-156655258">https://github.com/mapbox/rasterio/issues/524#issuecomment-156655258</a>.<div><br></div><div>Briefly: depending on the format driver, setting the geotransform can be a no-op if the given transform is ~= the identity transform. For GeoTIFF, both (0, 1, 0, 0, 0, 1) and (0, 1, 0, 0, 0, -1) are considered to be ~= identity and are invalid inputs that are ignored.<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Sean Gillies</div></div></div></div>