[gdal-dev] Re: Add GCP's to a file

Frank Warmerdam warmerdam at pobox.com
Sat Feb 20 21:53:57 EST 2010


Jukka Rahkonen wrote:
> Dan Greve <grevedan <at> hotmail.com> writes:
> 
>>
>> Question on the -gcp option in gdal_translate.  If i want to use it to 
>> specify the geographic referencing of the four corners do i need to
>> specify the center of the pixel, or the UL of the pixel.  
>> (e.g. -gcp 0 0 34 115 OR -gcp 0.5 0.5 34 115 .
> 
> 
> Hi,
> 
> Pixel values are integers and -gcp 0.5 0.5 34 115 does not make sense.  It is
> worth knowing that the anchor point of the pixel is in the top-left corner of
> the pixel (somebody hopefully corrects me if I am wrong) and the geographical
> coordinates should be taken from that point, not from the middle of the pixel.  

Folks,

To clarify the GCPs do support sub-pixel locations.  So you can use (0.5,0.5)
if you mean the center of the top left pixel while (0,0) is the top left corner
of the top left pixel and (1,1) is the bottom right corner of the top left
pixel (or the top left corner of the next pixel in if you prefer to think of it
that way).

> Also the extents reported by gdalinfo are the widest possible extents and if 
> those are to be used only UL coordinated can be used as it.  For other three
> corners there is a need to minus one pixel size in one or both axis directions.

The lower right corner reported by gdalinfo would be at
pixel/line coordinate (xsize,ysize).

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 gdal-dev mailing list