1

I'm working in QGIS. I have two TIFF files of the exact same dimensions, but one of them is georeferenced and the other isn't. I'd like to import the non-georeferenced file so that it aligns exactly with the georeferenced one, pixel for pixel. Using the georeferencer with GCPs is not precise enough. Is there a way to transfer the georeferencing info from the GeoTIFF to the unreferenced file?

This is the same question as here, except in my case, the georeferencing data seems to be embedded in the .tif file. I'll accept even solutions that require manually adding the data (CRS, origin, pixel size) into the unreferenced file. I'm just not familiar with the format so I'm not sure where to start.

2 Answers 2

1

You can translate the georeferenced tif to vrt, copy the result to another name and edit it with any text editor to change the SourceFilename tag:

gdal_translate -of VRT first.tif first.vrt
copy first.vrt second.vrt
notepad second.vrt
...
<SourceFilename relativeToVRT="1">second.tif</SourceFilename>

If you prefer a world file, try

gdal_translate -co TFW=YES first.tif ref.tif
copy ref.tfw second.tfw

to get a second.tfw with the referencing information.

0

I actually ended up creating a "world file" manually using the information from the georeferenced file:

[pixel size x]
0.0
0.0
[pixel size y]
[origin x]
[origin y]

Saved as unreferenced.tfw in the same location as unreferenced.tif, I can now add it into QGIS and it is referenced correctly.

The second and third lines refer to rotation and skew I believe, which were zero in my case. Used information on this page to learn how to form the .tfw file.

1
  • You can use gdal_translate to create the world file, no need to calculate the values yourself. I added the command line to my answer.
    – AndreJ
    Commented Dec 22, 2018 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.