# World file

A world file (. English spelling: worldfile ) is a small text file that geospatial reference contains an image. This branch file type was introduced by ESRI as a supplement for simple image formats. The file name extension is derived from the image type and is, for example, .jgw , .j2w , .pgw , .gfw, or .tfw for JPEG , JPEG 2000 , PNG , GIF , or TIFF image data. The reference system is missing from the file.

## File format

An image rotated 15 ° to the right (indicated with 4 pixels) in the target coordinate system (brown dashed). The yellow point is the origin of the target coordinate system. In the world file, the specified six parameters are saved in one line each.

A world file contains 6 lines with the 6 parameters of the affine transformation :

1. a11 = x component of the pixel width
2. a21 = y component of the pixel width
3. a12 = x component of the pixel height
4. a22 = y component of the pixel height (mostly negative)
5. b1 = x-coordinate of the center of the top left pixel
6. b2 = y-coordinate of the center of the top left pixel

## Interpretation of the parameters

The equations of the affine transformation are:

${\ displaystyle {\ begin {pmatrix} x \\ y \ end {pmatrix}} = {\ begin {pmatrix} a_ {11} & a_ {12} \\ a_ {21} & a_ {22} \ end {pmatrix}} \ cdot {\ begin {pmatrix} s \\ z \ end {pmatrix}} + {\ begin {pmatrix} b_ {1} \\ b_ {2} \ end {pmatrix}}}$

with the world coordinates (x, y) and the image coordinates (column s, line z).

The affine transformation covers the translations in x and y, the scales of the x and y axes, as well as the rotations of the x and y axes (and thus also the shear). If it is only a question of a similarity transformation , the following applies: a11 = - a22 and a12 = a21. There is often a minus in front of the pixel height, since the y-axis of the image coordinate system points downwards - i.e. H. the y-axis is mirrored.

The dimensions of a pixel can be calculated as follows:

• Pixel width: ${\ displaystyle {\ sqrt {a_ {11} ^ {2} + a_ {21} ^ {2}}}}$
• Pixel height: ${\ displaystyle {\ sqrt {a_ {12} ^ {2} + a_ {22} ^ {2}}}}$

The angles of rotation are calculated as follows:

• The rotation angle of the x-axis: ${\ displaystyle \ arctan {a_ {21} / a_ {11}}}$
• The rotation angle of the y-axis: ${\ displaystyle \ arctan {a_ {12} / - a_ {22}}}$

If the twist is only very small, the parameters a11 and a22 can be interpreted approximately as the size of the pixel in the x and y directions. a21 and a12 are then approximately zero.

In the general case in which distortions and shearings are present in both coordinate systems, the parameters cannot be interpreted clearly.

Due to a lack of information regarding the reference systems (projected and geographic coordinate systems), world files can only be used in a known context. The units of length and the reference system of the map in which the image is located are derived from this. With the GeoTIFF image format , these data are binary in the file header.

## example

Example of a world file, matching the middle picture below (in the reference system WGS 84 ):

1.669E-4
0
0
-9.278E-5
8.491
50.058


Lines 2 and 3, which describe the orientation and linear distortion of the image, are indicated with 0.0, since there is no rotation around the respective axes. The image was corrected accordingly beforehand. The units per pixel in the y-direction (line 4) are usually negative because an image has its point of origin at the top left, but a geographical coordinate system at the bottom left.

In the reference system used, the coordinate axes correspond to the geographical longitude and latitude in degrees. In the example, therefore, lines 5 and 6 define the upper left coordinate origin at 50.06 ° N and 8.5 ° E, a location southwest of Frankfurt. Together with the known pixel size of the image file, lines 1 and 4 define the image size in degrees on the card.

If, on the other hand, a projected reference system (for example UTM ) is used, the parameters are to be interpreted in the projected coordinate system (east value / north value), i.e. generally in the order of meters or meters per pixel.