[GIS] Fixing raster with wrong Eastings using QGIS and GDAL

gdalqgisraster

I get an error when trying to warp a tif file in QGIS:

ERROR 1: Too many points (35721 out of 35721) failed to transform,
unable to compute output bounds.

I am using QGIS 1.7.0 Wroclaw with gdal 1.8. I am trying to reproject from ETRS89 to HD72 EOV. There was an error in the data, with the UTM zone added to the eastings. That is, the x coordinates read 34327213.050 when they should read 327213.050 in UTM zone 34N. I have tried changing the .tfw file but this did not help. Then I translated the tif to a .vrt and edited the vrt, removing the rogue 34, and fixing the extent. This also did not help – I still get the same error when I try to warp. In layer properties, this raster now has the same origin, extent and SRS as other similar rasters, but only this one gives the error.

How do I work this out?

A similar question (Setting projection of tif file in QGIS?) was asked 4 months ago, but it was not the exact same problem, and the OP did not explain how the problem was resolved.

Best Answer

Have you tried using gdal_translate to fix the error? Something like this should work:

gdal_translate -a_srs EPSG:32634 -a_ullr <actual coordinates go here> broken.tif fixed.tif

The order of the coordinates should be: left, top, right, bottom.

This should ignore everything that's in the TIFF's metadata and overwrite it with the proper bounds and projection. Also, by default, it'll embed the bounds in the TIFF rather than relying on a .tfw, so don't worry if one isn't created with your new file.

A link to the previous question might be useful, even if its not exactly the same issue.