Open ConorMurphy21 opened 1 year ago
@ConorMurphy21 I'm wondering how support for that would be useful: are there datasets where there is just the .tif + .tfwx, without a .tif.aux.xml (or with a .tif.aux.xml that doesn't contain a
@rouault From my understanding, when ESRI adjusts georeferencing of geotiffs it creates a .tif
+ .tfwx
+ .tif.aux.xml
. The .tfwx
file in place of the .tfw
file. I don't think the .tif.aux.xml
or .tif
file always store enough information to properly georeference the image on it's own. From esri docs
World files and georeferencing
If the transformation cannot be expressed as a world file, the transformation information will be written in the .aux.xml file and also in the world file, as an approximate affine transformation. This world file that is created will have an x on the end of the extension name. For example, a TIFF image with an approximate affine transformation has the extension .tfwx. Keep in mind that this is not an exact transformation; it is only an approximation.
There is a special case where this text file contains a true affine transformation. If using the Save option on a raster dataset that already contains map coordinates, a text file with the x extension is written. For example, if georeferencing is performed on a TIFF image that already contains map coordinates, then a .tfwx file that contains a true affine transformation will be created.
It seems to me like tfwx
files should be used almost exactly like tfw
files just with the understanding that it is an estimated affine transform instead of an exact affine transform. I think in a lot of cases the tfwx
file won't be needed because there is information in the .tif
file, but in the same cases that GDAL falls back on tfw
it should probably be able to fall back on tfwx
?
From reading other forums I think this is somewhat related to https://github.com/OSGeo/gdal/issues/8083 because ESRI creates tfwx
to estimate affine transform, and then GCP's from aux.xml
to make it more accurate. Basing this off of this post
but in the same cases that GDAL falls back on
tfw
it should probably be able to fall back ontfwx
?
from what you quote above, it looks like it would be a non-nominal case where the .tif.aux.xml would have been removed. Looking for the tfwx would be definitely possible, but would require more file probing. So the benefit of doing this isn't totally obvious.
hmm I didn't realize GDAL ignores tfw
files in the case of the existence of aux.xml
files. I think that the point of .tfwx
files is to be used in conjunction with aux.xml
files. So it would not be super uncommon for this to occur, I think the only requirement for this to occur would be for the georeferencing tags on the internal tif
file to be missing?
Again based off of https://github.com/OSGeo/gdal/issues/8083 and post
feature request:
tfwx files are approximate world files created by ARCGis when an exact affine transform cannot be used to georeference an image.
Expected behavior and actual behavior.
Currently geotiff files translated next to a tfwx sidecar file will be translated without georeferencing the image using the tfwx file. If this feature were to be implemented the information from the tfwx file would be used to georeference the image.
Steps to reproduce the problem.
Either "gdalinfo myfile" or roundtripping the tif file should reproduce this behavior
Operating system
All
GDAL version and provenance
All
Known Workarounds
ArcGIS users can rectify their files instead of georeferencing them