I have 2 geotiffs: "One.tif", and "Two.tif". I want to use gdalwarp to rectify One.tif based on the bounding box of Two.tif.

First I use gdalinfo to get the minx miny maxx maxy of Two.tif for input into the call.

I set up the call:

gdalwarp -t_srs "EPSG:32615" -multi -te 497025.024 4925030.200 497811.456 4925947.904 -ts 256 256 -overwrite One.tif Output.tif

The result, Output.tif, has the correct SRS and coordinates, resolution, etc., but there is no data in the band. It is entirely composed of 0's. When I run gdalinfo on One.tif, it gives me proper statistics for the single Float64 band within that geotiff.

Is it a no_data issue? Do I need more info for the gdalwarp call?

  • 1
    Can you update your post to elaborate on what do you mean by "rectify"? Do One.tif and Two.tif overlap? Do One.tif and Two.tif have the same coordinate system? I am guessing the problem is that One.tif does not overlap the area of Two.tif, so there are no 'meaningful' values to place into pixels of Output.tif. – Logan Byers Oct 25 '16 at 14:13

You have understood wrong what -te does in gdalwarp http://www.gdal.org/gdalwarp.html. It is cropping the output image to given extents but -te does not have an effect on the georeferencing. With your command the georeference of output.tif is computed from the SRS and extents which are taken from the metadata of one.tif after applying the transformation into EPSG:32615.

A GDAL tool for you is gdal_edit.py http://www.gdal.org/gdal_edit.html. Use parameter

-a_ullr ulx uly lrx lry:

Assign/override the georeferenced bounds of the dataset.

Another option is to set four Ground Control Points with gdal_translate http://www.gdal.org/gdal_translate.html by using the -gpc parameters. After adding the ground control points you should write the result to normal GeoTIFF with gdalwarp.

I wonder why do you want to do that task. Is the image one.tif originally a non-georeferenced image?

  • Yes one.tif is an artifical image that has the same dimensions (row,col) as two.tif, but is not georeferenced. – svh160 Oct 26 '16 at 19:09
  • Then gdal_edit.py should work for you. Remember to assign correct srs as well. – user30184 Oct 26 '16 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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