World Files - Defining Image Rotation

Ed McNierney ed at TOPOZONE.COM
Sat Dec 22 15:46:48 EST 2007


David -

Normally a georeferenced image uses a coordinate system such that every
pixel on the top row, for example, has the same Y coordinate, and every
pixel on the left column has the same X coordinate.  Non-zero rotational
parameters in the world file indicate that this is not correct, and show
how to compute the X and Y coordinates of any pixel in the image
starting from the top left (as usual).  Remember that this is a
calculation of what those coordinates ARE, not what you want them to be.
This may be the opposite sense of the rotation angle from what you
expect; you may be describing a "square" image that has been rotated 43
degrees CLOCKWISE, so the CCW rotation is performed as the file is read.

But I have no real world experience with such files.  The second and
third lines should be the X and Y pixel resolutions times sin(angle),
while the first and fourth should be the X and Y pixel resolutions times
cos(angle).  You will probably need to fiddle with the signs of the
second and third lines to get things to work, assuming the software
you're using reads them at all!  And the fourth line is very likely to
be a negative number (not positive, as you show below).

Let us know what happens!

     - Ed

 -----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Fawcett, David
Sent: Saturday, December 22, 2007 12:35 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] World Files - Defining Image Rotation

After spending a lot of time with my friend Google, I have come to the
conclusion that documentation on how to calculate the rotation
parameters of a world file is very hard to find.  

I have an image that I would like to georeference and rotate using a
world file.  If I want to rotate the image 43 degrees counter-clockwise,
how do I go about calculating the rotation parameters in the world file?


Here are the params that I have already determined

0.177959962	pixel size x direction
                rotation x term
	        rotation y term
0.177941345	pixel size y direction
583930.6469	ul xcoord
4895626.67	ul ycoord

Thanks, 

David.



More information about the mapserver-users mailing list