# [Geotiff] deskewing

Cody Benkelman benkelman at yahoo.com
Tue Jan 16 13:06:09 EST 2007

```(to the list: sorry about my prior post - my response wasn't included!)

Zoltan

Many people assume the 2nd & 3rd terms in the World file are "row and column
rotation terms" but that's not quite accurate.

The six terms in the world file represent an affine transformation, as
follows:

Easting = Ax + By + C
Northing = Dx + Ey + F

Where

Easting = calculated x-coordinate of the pixel on the map
Northing = calculated y-coordinate of the pixel on the map

x = X coordinate (column number) of a pixel in the image
y = Y coordinate (row number) of a pixel in the image

and the affine transformation parameters are stored in
the world file in this sequence:
A
D
B
E
C
F

Thus while most images are stored with square pixels and zero rotation,
generating world file parameters (first four terms) such as this:
1.500
0.000
0.000
-1.500

...if the same image is intended to be rotated by 90 degrees, its world file
terms would become

0.000
1.500
1.500
0.000

...so if you expect the first and fourth terms to be "x and y resolution",
this would be confusing - but when you understand the proper definition of
terms, it's a simple transformation.  In the example you provided, your
image not only has a slight rotation but the X and Y pixel resolution are
not equal.

I hope that helps - if you want more information, feel free to contact me
directly.

Cody A. Benkelman
ASPRS Certified Mapping Scientist - Remote Sensing (#RS-144)
17 Willowbrook Close
Whitefish, Montana  59937
cell (406) 270-1176

-----Original Message-----
From: geotiff-bounces at lists.maptools.org
[mailto:geotiff-bounces at lists.maptools.org] On Behalf Of Frank Warmerdam
Sent: Tuesday, January 16, 2007 9:38 AM
To: Zoltan Szecsei
Cc: geotiff at lists.maptools.org
Subject: Re: [Geotiff] deskewing

Zoltan Szecsei wrote:
> Hi,
> Is there an easy utility (linux commandline preferable, but windows
> OK) to de-skew a geo-referenced scanned map?
> Typically the TFW files look like this:
>
> 0.317469
> 0.001049
> 0.000994
> -0.317666
> -19902.462151
> -3208549.358736
>
>
> Why is the row-rotation different from the column rotation?

Zoltan,

The gdalwarp utility will produce a nice "north up" image from a rotated or
skewed tiff+world (or geotiff).

eg.

gdalwarp skewed_input.tif northup_output.tif

The FWTools suite includes the gdalwarp command.

http://fwtools.maptools.org/

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

_______________________________________________
Geotiff mailing list
Geotiff at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/geotiff

```