GDAL How-to

Georeference a satellite image

First, you need an image, and a lat/lng footprint

So we'll start with a jpeg containing an ASAR image


And the lat/lng of the 4 corners of the image

-92.246384,32.628281 -87.924263,31.908293 -95.477028,16.658155 -91.673897,15.906074

use gdalinfo to get the dimensions of the original image

gdalinfo ASA_WSM_1PNPDK20110831_161028_000002693106_00112_49695_3285.N1_4E5EC73B_image_0150.jpg
Files: ASA_WSM_1PNPDK20110831_161028_000002693106_00112_49695_3285.N1_4E5EC73B_image_0150.jpg
Size is 5532, 23760
Coordinate System is `'
Image Structure Metadata:
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,23760.0)
Upper Right ( 5532.0,    0.0)
Lower Right ( 5532.0,23760.0)
Center      ( 2766.0,11880.0)
Band 1 Block=5532x1 Type=Byte, ColorInterp=Red
  Image Structure Metadata:
Band 2 Block=5532x1 Type=Byte, ColorInterp=Green
  Image Structure Metadata:
Band 3 Block=5532x1 Type=Byte, ColorInterp=Blue
  Image Structure Metadata:

The first thing to do create a temporary tiff with GCPs (Ground Control Points) that map each corner of the image to a lat/lng pair.  We also set the projection to ESPG:4326 which is what Google Earth uses

gdal_translate -a_srs EPSG:4326 \
-gcp 0 0 -92.246384 32.628281 \
-gcp 5532 0  -87.924263 31.908293 \
-gcp 0 23760 -95.477028 16.658155 \
-gcp 5532 23760 -91.673897 15.906074 \ ASA_WSM_1PNPDK20110831_161028_000002693106_00112_49695_3285.N1_4E5EC73B_image_0150.jpg \

Next we run gdalwarp to create the geo-referenced tiff with "north up".  It makes a squared up image by adding buffer space around the original image.

gdalwarp -tps xlate_temp.tif georeferenced.tif

At this point you should be able to load georeferenced.tif into Google Earth as an image overlay, and the original image should appear within the footprint

If the image is really big and you want to make a smaller version for testing, add -ts and set a width for the final image.  Leave the height set to 0 and gdalwarp will compute it based on the width

gdalwarp -ts 2000 0 -tps xlate_temp.tif georeferenced.tif

If you want to set the nodata color for the buffer that is created around the original image, use -dstnodata. This will set the buffer area to white:

gdalwarp -dstnodata "255 255 255" 0 -tps xlate_temp.tif georeferenced.tif

Other References