I'm trying to alter the metadata in a Geotiff header via a .tfw file. When I change Pixel Size in the .tfw file, that is reflected in GDALINFO how I would expect.
However, when I change the Origin Value in the tfw file, GDALINFO is not displaying exactly what I type in the .tfw file. It's displaying a long float value. I'm ok with having repeating zeros like the Pixel Size data but I can't have random numbers like the Origin value.
and when I run GDALINFO I get these results..
Any ideas why what I put in the .tfw file isn't displaying in GDALINFO.
I've tried using Python to resolve this issue but still not getting desired results.
from osgeo import gdal from osgeo import gdalconst tiff_path = r"E:\temp\fran\pizelsize\test.tif" data2 = gdal.OpenShared(tiff_path, gdalconst.GA_Update) geoTransform_tuple = data2.GetGeoTransform() list_of_tuple = list(geoTransform_tuple) for x in list_of_tuple: print x print '\n' origin_X = round(list_of_tuple, 3) origin_Y = round(list_of_tuple, 3) res_X = round(list_of_tuple, 4) res_Y = round(list_of_tuple, 4) list_of_tuple = origin_X list_of_tuple = origin_Y list_of_tuple = res_X list_of_tuple = res_Y for x in list_of_tuple: print x data2.SetGeoTransform(list_of_tuple) data2 = None
I've tried setting everything to a float. I've tried using the Decimal module. I've tried converting to string then back to float. I get the desired result displayed in python. But when I try to write it to the tiff, only Pixel Size gets updated.
The second output is what I want in the tiff. But GDALINFO gives me this.
Pixel Size updated, Origin either not updated or calculated some other way.