Skip to content

listgeo reports incorrect corner coordinates if RasterPixelIsPoint is set #35

@CaptainCarrot

Description

@CaptainCarrot

listgeo currently treats all GeoTIFFs as if the RasterPixelIsArea is set, leading to incorrectly reported corner coordinates if RasterPixelIsPoint is set instead. It should report them as specified here.

Example:

I created a rasterized sample data in WGS 84, where the coordinates pixel center of the top left corner are exactly (-81.38, -0.04) and the ones of the bottom right pixel center are (-68.65, -18.45). listgeo reports the following:

Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
         0                 0                 0                
         -81.38            -0.04             0                
      ModelPixelScaleTag (1,3):
         0.0212520868113522 0.0307345575959933 0                
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeGeographic
      GTRasterTypeGeoKey (Short,1): RasterPixelIsPoint
      GeographicTypeGeoKey (Short,1): GCS_WGS_84
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      End_Of_Keys.
   End_Of_Geotiff.

GCS: 4326/WGS 84
Datum: 6326/World Geodetic System 1984
Ellipsoid: 7030/WGS 84 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: User-Defined (1.000000m)

Corner Coordinates:
Upper Left    (-81.3800000,-0.0400000)
Lower Left    (-81.3800000,-18.4807346)
Upper Right   (-68.6287479,-0.0400000)
Lower Right   (-68.6287479,-18.4807346)
Center        (-75.0043740,-9.2603673)

The reported upper left coordinate is exactly the model tie point, and all the other corners are offset by one pixel.

For comparison, here the corners reported by gdalinfo:

Corner Coordinates:
Upper Left  ( -81.3906260,  -0.0246327)
Lower Left  ( -81.3906260, -18.4653673)
Upper Right ( -68.6393740,  -0.0246327)
Lower Right ( -68.6393740, -18.4653673)
Center      ( -75.0150000,  -9.2450000)

Notes

  • the tests currently contains only images with RasterPixelIsArea, none with RasterPixelIsPoint
  • GDAL changed their behaviour a while ago, see here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions