Wednesday, July 12, 2017

Applying a simple X,Y shift or translation to a raster GeoTIFF file using GDAL

Sometimes when comparing a raster ortho-mosaic GeoTIFF file to ground control points (GCPs), the raster file may appear to be slightly shifted relative to the ground control points. To resolve this problem correctly, it may be necessary to regenerate the ortho-mosaic after adjusting the tie points. But sometimes, if the shift is linear or you want to do a fast correction, then the open source software GDAL may be able to solve the problem for you.

To shift a raster GeoTIFF file e.g. input.tif with GDAL, do the following:

  1. Open up a Windows Command Prompt.
  2. Type in the gdal_translate command with the a_ullr option:

    C:\> gdal_translate -a_ullr 760726.437 4557390.415 772996.466 4540826.364 input.tif translate.tif

    Note: 
    translate.tif is the output filename
    -a_ullr specifies the new upper left X, upper left Y, lower right X, lower right Y coordinates  

  3. Run the command.

    Processing messages appear. The file is shifted to the new coordinates.


    The file is shifted to the new coordinates.

No comments: