[FWTools] gdalwarp issue?

Frank Warmerdam warmerdam at pobox.com
Wed Dec 15 11:18:02 EST 2010

On 10-12-15 09:04 AM, jkenneally at cartenav.com wrote:
> Hello,
> I'm having an issue using gdalwarp, and I'm not sure if I'm using the utility
> incorrectly, or if I'm just trying to make it do something it can't do.
> I'm trying to perform a crude geo-rectification on a set of aerial photo's. For
> the test case I am just assigning four gcps to the source image corners using
> gdal_translate. This stage seems to work fine. I am then intending to use
> gdal_warp to produce an output image that has been transformed based on the
> assigned gcps. However, no matter what I assign as the image corner
> coordinates, gdal_warp still seems to produce a 'square' final image.
> The easiest way to demonstrate the issue is in cases where the camera was not
> pointed straight down when the aerial photo was taken. This creates a source
> image where the bottom (near) corners are geographically closer to each other
> than the top (far) corners are. In this case I am expecting the warped output
> image to contain a trapezoid-ish shape of aerial imagery with no data (ie
> white) pixels around the outside.
> However, while gdal warp does seem to rotate the source images to correctly
> align with lat/lon lines, it doesnt seem to distort the image into the
> trapezoid shape.
> If I load the image that was georeferenced through gdal_translate into Global
> Mapper it does appear properly (ie trapezoidal), and can be saved back to disk
> in that 'warped' form, but I'm really hoping to be able to do this through
> fw_tools/gdal.
> Am I missing something obvious or is this not possible with gdal_warp?


gdalwarp should be able to build a first order polynomial model from 4 gcps
and warp based on that giving you a trapazoidal result (with missing data
usually set to black).   Could you make the file you are using, and the
commands, available so I/we can more closely examine what is going wrong?

Normally gdalwarp should use the GCPs from your source image automatically.
Possibly you also have a geotransform set on the source image that is wrong
and this is being used in preference to the gcps?

PS. as Rengifo mentions, OSSIM is great if you want to do rigerous
orthorectification - I'll assume you want to do a simple polynomial warp
based on gcps.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the FWTools mailing list