[gdal-dev] Re: Help with setting GCPs in a GeoTiff

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Fri Oct 7 00:27:05 EDT 2011


matt.feemster <matt.feemster <at> ga-asi.com> writes:


> So my question involves three steps:
> 
> 1) Is it possible to store only corner coordinates as a way of telling
> GDAL/GeoTiff what the geo information is for a GeoTiff? Again,
> transformations will not work here.
Yes

> 2) If it is possible, how to go about it?

For example for a 10000x10000 pixel image
gdal_translate source.tif output.tif -gcp 0 0
285113.632 6713217.584 -gcp 10000 0 284658.101
6703227.690 -gcp 0 10000 295103.322 6712761.873 -gcp
10000 10000 294647.828 6702772.378

Note that the anchor point of GDAL gcp is the top-left corner of the pixel and
counting X and Y starts from zero. Therefore in this example X and Y values
10000 are used even that means binding gcp to a pixel that is just outside the
image. If you have measured control points from the centers of pixels you may
need to calculate also half a pixel shifts here and there.
 
> 3) When assigning the GCPs, what exactly do the 'x' and 'y' members of the
> GDAL_GCP structure mean? Per the documentation: X position of GCP in
> georeferenced space. Are x and y a lat/lon pair? ECEF x/y? UTM
> easting/northing? What exactly should I be assigning these values.

X is easting or longitude, Y is northing or latitude.

-Jukka Rahkonen-





More information about the gdal-dev mailing list