[Gdal-dev] Georeferencing an image using gdalwarp: format of GCPs?

wqual wolfgang.qual at gmx.net
Thu Jul 27 11:35:35 EDT 2006


Hi Frank,
thank you very much for this helpful advice! It worked very well. The only 
thing I need to find out was, were the origo of the image was (upper left 
corner of the image) and that qgis y-coordinates were negative (but must be 
positive).

Image in qgis:

0/0-------------------------------------------100/0
|                                                  |
|                                                  |
0/-100---------------------------------------100/-100

and has to be 0/0, 100/0, 0/100, 100/100...

Best regards
Wolfgang

Am Donnerstag 27 Juli 2006 pH:41:13 nachmittags/abends schrieb Frank 
Warmerdam:
> wqual wrote:
> > Hi list,
> > I have several scanned maps that I would like to give real coordinates
> > using gdalwarp: after creating a GCS-file (a text file with four columns
> > x_image y_image, east_coordinates, north_coordinates), I tried the
> > following command:
> >
> > wqual at standalone:~$ gdalwarp -t_srs /home/wqual/karte_GCP.txt Input_1.jpg
> > output.tif
> >
> > But the only thing I get is:
> > ERROR 1: Translating source or target SRS failed:
> > /home/wqual/karte_GCP.txt
> >
> > Question therefore: what is the correct format of a GCS-file which can be
> > read by gdalwarp? I would be glad to receive any comments on this.
>
> Wolfgang,
>
> I don't believe gdalwarp supports having gcps supplied on the commandline.
> So you end up having to use gdal_translate first to add gcps to a file.
>
> eg.
> gdal_translate -gcp 0 0 -117.25 33.0     -gcp 1000 0 -117 33.0 \
>                 -gcp 0 1000 -117.25 32.75 -gcp 1000 1000 -117 32.75 \
>                 Input_1.jpg Input_1_gcps.tif
> gdalwarp Input_1_gcps.tif output.tif
>
> You can also place the gcps in a file, and use the --optfile switch to
> reference the file.  For instance if your karte_GCP.txt contained:
>
> -gcp 0 0 -117.25 33.0
> -gcp 1000 0 -117 33.0
> -gcp 0 1000 -117.25 32.75
> -gcp 1000 1000 -117 32.75
>
> then you could do:
>
> gdal_translate --optfile karte_GCP.txt Input_1.jpg Input_1_gcps.tif
>
> Keep in mind that the gcp arguments are "pixel line geo_x geo_y".
>
> Best regards,



More information about the Gdal-dev mailing list