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

Ludwig M Brinckmann ludwigbrinckmann at gmail.com
Mon Jun 25 12:53:52 EDT 2007


Frank, thanks for your usual quick reply.

As I have thousands of files, anything manual was not an option (of course
one could implement your suggestion with sed), so I went the way reading in
both files and stealing one file's GCPs with GetGCPs() and write the whole
shebang out again -- this also works of course with metadata, noDataValue
etc.

Ludwig

On 25/06/07, Frank Warmerdam <warmerdam at pobox.com> wrote:
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070625/efce2ac6/attachment.html


More information about the Gdal-dev mailing list