[gdal-dev] Differences in the coordinates of the origin in tfw-file and GeoTiff

Even Rouault even.rouault at mines-paris.org
Fri Dec 18 15:39:18 EST 2009


Yes, this is always a bit surprising at the beginning. There's a 
half-pixel size shift between worlfile and GDAL conventions for the 
origin. wordfile origin is at the center of the topleft pixel, whereas 
GDAL origin is at the topleft corner of the topleft pixel. But GDAL 
takes care of applying the right shift when reading from or writing into 
worldfile.

Your 5cm shift is indeed half the pixel size in your example.

Fischer, Andreas a écrit :
>
> Dear list,
>
> while translating or warping rasterdata with gdal_translate or 
> gdalwarp I experienced a difference in the origin of an image in the 
> tags of the GeoTiff-header and the tfw-file.
>
> The header of my original image looks as follows:
>
> Driver: GTiff/GeoTIFF
>
> Files: C:\test\in.tif
>
> Size is 10000, 10000
>
> Coordinate System is:
>
> PROJCS["DHDN / 3-degree Gauss-Kruger zone 3",
>
> GEOGCS["DHDN",
>
> DATUM["Deutsches_Hauptdreiecksnetz",
>
> SPHEROID["Bessel 1841",6377397.155,299.1528128000009,
>
> AUTHORITY["EPSG","7004"]],
>
> AUTHORITY["EPSG","6314"]],
>
> PRIMEM["Greenwich",0],
>
> UNIT["degree",0.0174532925199433],
>
> AUTHORITY["EPSG","4314"]],
>
> PROJECTION["Transverse_Mercator"],
>
> PARAMETER["latitude_of_origin",0],
>
> PARAMETER["central_meridian",9],
>
> PARAMETER["scale_factor",1],
>
> PARAMETER["false_easting",3500000],
>
> PARAMETER["false_northing",0],
>
> UNIT["metre",1,
>
> AUTHORITY["EPSG","9001"]],
>
> AUTHORITY["EPSG","31467"]]Origin = 
> (3406000.000000000000000,5703000.000000000000000)
>
> Pixel Size = (0.100000000000000,-0.100000000000000)
>
> [ … ]
>
> Corner Coordinates:
>
> Upper Left ( 3406000.000, 5703000.000) ( 7d38'50.85"E, 51d27'18.40"N)
>
> Lower Left ( 3406000.000, 5702000.000) ( 7d38'51.81"E, 51d26'46.05"N)
>
> Upper Right ( 3407000.000, 5703000.000) ( 7d39'42.63"E, 51d27'19.00"N)
>
> Lower Right ( 3407000.000, 5702000.000) ( 7d39'43.58"E, 51d26'46.64"N)
>
> Center ( 3406500.000, 5702500.000) ( 7d39'17.22"E, 51d27'2.52"N)
>
> The tfw-file coming out using the creation option -co TFW=YES 
> (gdal_translate -co TFW=YES C:\test\in.tif C:\test\out.tif) looks like 
> this:
>
> 0.1000000000
>
> 0.0000000000
>
> 0.0000000000
>
> -0.1000000000
>
> 3406000.0499999998
>
> 5702999.9500000002
>
> The GeoTiff-tags in this image (out.tif) is still the same as above. 
> But amazingly there is a slight difference in x and y coordinate of 
> approximately 5 cm between tfw and GeoTiff. This difference does occur 
> the other way around too. For example creating a GeoTiff from a png 
> image with a tfw-file I get the difference in the new GeoTiff-tags as 
> well.
>
> I start with those values in the tfw-file …
>
> 0.0846596700
>
> 0.0000000000
>
> 0.0000000000
>
> -0.0846596700
>
> 392000.0000000000
>
> 5733000.0000000000
>
> … and get these in the GeoTiff:
>
> Origin = (391999.957670164990000,5733000.042329834800000)
>
> Pixel Size = (0.084659670000000,-0.084659670000000)
>
> As mentioned above, the coordinates for the origin are not the same, 
> but the image didn't change. Does anybody know about this behavior?
>
> I would be glad to hear from you.
>
> Thanks so far and best regards
>
> Andreas
>
> Im Auftrag
>
> Andreas Fischer
>
> Kreis Unna - Der Landrat
> Zentrale Datenverarbeitung
> Friedrich-Ebert-Straße 17
> 59425 Unna
>
> Fon 02303 27-4416
> Fax 02303 27-2896
>
> Diese E-Mail wurde beim Ausgang auf Viren geprueft. Wegen der potentiellen Gefahr auf den Uebertragungswegen wird zu einer Vireneingangskontrolle geraten. Eine Haftung für Virenfreiheit wird ausgeschlossen.
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list