[gdal-dev] world file to world file

Frank Warmerdam warmerdam at pobox.com
Fri Feb 8 08:55:01 EST 2008


Michele Zanin wrote:
> Dear gdal experts,
>   i'm very happy with gdal because it solved a lot of difficult
> situations for me, but this time I'm not able to find the right
> sequence of operations to reach my goal.
> 
> This is the problem.
> I have a standard (=not geotiff) tiff image and its corresponding
> world file using projection epsg:3003, something like:
> 
> name.tfw
> 1.00000000000000
> 0.00000000000000
> 0.00000000000000
> -1.00000000000000
> 1615240.50000000000000
> 5139639.50000000000000
> 
> My goal is to  create with gdal another world file for the same tif,
> using a different projection, in my case epsg:4326. An example
> (numbers are from another image):
> 
> another.tfw
> 0.000167584405076
> -0.000000478207876
> -0.000000240088571
> -0.000115295080174
> 11.689665492171006
> 47.091567061470897
> 
> It should be not difficult to write a program to do this
> transformation, but before starting to write it myself, I think it's a
> good idea to ask you for a simpler solution, maybe using a combination
> of standard gdal utilities.

Michele,

I'm guessing that "another.tfw" represents the *approximate* world file
for the original file, but interpreted in EPSG:4326 - is that right?

One approach to computing such a thing would be to transform the four
corners of the file from the original coordinate system to epsg:4326
and then use the GDALGCPsToGeotransform() function.  That function
computes an approximate geotransform from a set of control points.

The Geotransform is of course just the contents of the world file,
though in a different order.

Unfortunately, doing the above is not possible with any of the command
line utilities.  I see that GDALGCPsToGeotransform() is accessable from
the modern swig bindings so it should be possible to write a script to
do this (though it might be a bit messy).  It could also of course be
written as a small C/C++ utility.

Good luck,
-- 
---------------------------------------+--------------------------------------
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