Half pixel shift in geotransform from AAIGRID to GTIFF
|Reported by:||silyko||Owned by:||warmerdam|
|Severity:||normal||Keywords:||geotiff, ascii grid|
When doing a gdal_translate on an AAIGRID which uses the xllcenter, yllcenter convention, the georeference of the output tif will be shifted half a pixel / cellsize, IF the input has no SRS and no SRS is attached to output. This is NOT the case, if e.g. attaching a SRS with -a_srs.
As explained by Even Rouault: """This is a defect of the GeoTIFF writer that writes the GeoTIFF Tiepoints with the PixelIsPoint? convention (since your original data is flagged as such), but fails to write GTRasterTypeGeoKey=RasterPixelIsPoint? as a geotiff key when there's no SRS"""
The geotransform of an AAIGRID, without any SRS, using the "center" convention is read correctly. The first "point" will be half a pixel downwards and rightwards from the upper left corner. Personally, I have always assumed that this is the GDAL-convention, regardless of format and other metadata items - knowing myself whether to interpret values as points or pixels, depending on data.
So I guess that for me the confusing part is the change in geotransform when doing no transformations or interpolations. I do not know if this may apply to other formats as well, or if it is specific to the geotiff driver.