[gdal-dev] Fastest way to add the GeoTransform to a raster file with Python

Frank Warmerdam warmerdam at pobox.com
Thu Sep 18 12:09:13 EDT 2008


On 9/18/08, Matthieu Rigal <rigal at rapideye.de> wrote:
> Hi all,
>  Since the method of Create, SetGeoTransform, etc... is "complicated" and
>  unefficient from a performance point of view, what is the way to quickly add
>  the GeoTransform, taken from a referenced raster to a raster that have lost
>  the information.

Matthieu,

I assume the approach that is complicated is to create a
whole new image with Create(), setting the geotransform on
that and then copying over all the image data.  is that what
you mean?

What format of imagery are you working with?  There are
different limitations on different drivers with regard to updating
georeferencing "in place".  For for some formats you can just
open a dataset in update mode, and call SetGeoTransform()
to update the georeferencing.  For other formats this is not
possible.

Some formats support world files with various extensions.  For
these formats the easiest approach might be to just manually
write out a world file.

>From the commandline the easiest way is to use gdal_translate
and the -a_ullr switch though internally this is of course creating
a new dataset and copying everything over.

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