Ticket #2126 (closed defect: duplicate)
Bug in reading georeferencing of geotiff
| Reported by: | moellney | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | default | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In the attached example the calculation of the adfGeoTransform fails.
The extreme simple example is just one DTM data point at 0° Lat and 0° Long with the extend of 0.0083333333. (downloaded from geoengine.nima.mil).
So the adfGeoTransform should be:
-0.0083333333 / 2
0.0083333333
0.0
0.0083333333 / 2
0.0
-0.0083333333
but we get:
0.0
0.0083333333
0.0
0.0
0.0
-0.0083333333
I think the problem is in geotiff.cpp (http://trac.osgeo.org/gdal/browser/branches/1.5/gdal/frmts/gtiff/geotiff.cpp#L3258 ):
adfGeoTransform[0] =
padfTiePoints[3] - padfTiePoints[0] * adfGeoTransform[1];
adfGeoTransform[3] =
padfTiePoints[4] - padfTiePoints[1] * adfGeoTransform[5];
shouldn't his be more like
adfGeoTransform[0] =
padfTiePoints[3] - (padfTiePoints[0] + 0.5) * adfGeoTransform[1];
adfGeoTransform[3] =
padfTiePoints[4] - (padfTiePoints[1] + 0.5) * adfGeoTransform[5];
to reflect the adfGeoTransform definition to be the upper left corner of the upper left raster area?
And what about the next "if" case for TIFFTAG_GEOTRANSMATRIX: http://trac.osgeo.org/gdal/browser/branches/1.5/gdal/frmts/gtiff/geotiff.cpp#L3270
Just from the "sake of symmetry" it looks wrong, too.
Michael

