[Mapserver-west] georeferencing with GDAL

Tyler Mitchell tylermitchell at shaw.ca
Wed Jun 22 21:22:16 EDT 2005


On June 22, 2005 12:27 pm, Ken-ichi wrote:
> Hi all.  First, it was great meeting many of you at OSG '05.  Always
> good to put faces to names.

Likewise!  Thanks for introducing yourself.

> Second, forgive me if this is OT, but how do you georeference with GDAL?

For the record, nothing is off-topic, so go for it!

>   According to the docs, gdalwarp can take a raw file with GCP "control
> information" as input, but how do you save the control info to the file?
>   Is there a way to do it with an external file of GCPs?  Or is there a
> way to save GCPs to the file within Erdas IMAGINE?  I basically have a
> whole mess of raw tiffs with GCPs that I need to georeference, and it
> would make my life a lot easier if I could just automate it with GDAL.

It's not obvious, but you can use gdal_translate to add GCP's to an image, by 
using the -gcp option.  Here's the option syntax:
-gcp pixel line easting northing
For multiple points (e.g. one for each corner) you just add another -gcp 
option with the values.  So, you might do something like:

gdal_translate -gcp 0 0 -180 90  -gcp 0 300 -180 -90  -gcp 600 0 180 -90  -gcp 
600 300 180 90 input.tif output.tif

Then run it through gdalwarp to transform the image.  Hope that helps!

Tyler


More information about the Mapserver-west mailing list