Ticket #2126 (closed defect: duplicate)

Opened 5 years ago

Last modified 5 years ago

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

Attachments

GeoTIFF.tif Download (0.6 KB) - added by moellney 5 years ago.
Simple geotiff file downloaded from geoengine.nima.mil: Just one DTM point at 0°,0° with extend of 30arcsec.

Change History

Changed 5 years ago by moellney

Simple geotiff file downloaded from geoengine.nima.mil: Just one DTM point at 0°,0° with extend of 30arcsec.

Changed 5 years ago by moellney

  • status changed from new to closed
  • resolution set to duplicate

Seems to be handled now by: #2178.

Note: See TracTickets for help on using tickets.