[Gdal-dev] Copying GCPs from one file to another

Frank Warmerdam warmerdam at pobox.com
Mon Jun 25 11:55:52 EDT 2007


Ludwig M Brinckmann wrote:
> I have a set of files with GCPs and a set of files that are the result 
> of processing the first, which lack the GCPs. The files are GeoTiffs and 
> they have the same shape.
> 
> Is there a simple way of getting the GCPs out of the first files and to 
> attach them to the other?
> 
> (Simple means simpler than programmatically reading in the georef'ed 
> file and the non-georef'ed, extracting the GCPs and rewriting the second 
> set, now with GCPs)

Ludwig,

There is no really simple way of doing this.

If I had to do it, I would utilize VRT files.  Basically I would:

1) gdal_translate -of VRT original.tif original.vrt
2) gdal_translate -of VRT result.tif result.vrt
3) copy the GCPs section of original.vrt to result.vrt in a text editor.
4) gdal_translate result.vrt result_with_gcps.tif

If you only want to do it a very few times this approach should be ok.
This general approach of using VRT files so that various kinds of metadata
can be copied/modified/etc can be applied to many similar problems.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list