Affine transformations for coordinate systems

Last modified Jul 2018

In addition to the normal projection parameters, you can use affine parameters to modify the coordinates. This can be useful for a number of purposes, including defining a local grid system for a work site or mine.

Affine parameters consist of six numbers, usually represented by labels A through F, which are used to modify the easting (x) and northing (y) as shown below to produce modified coordinates x' and y':

x' = A * x + B * y + C
y' = D * x + E * y + F

These affine formulas can rotate, scale and offset the original coordinates. Obviously, if A=1 and E=1 and the other params are all zeros, then x and y are unchanged by the affine transform. Therefore, the default affine parameters (A thru F) in the Coordinate Master app are 1,0,0,0,1,0.

Sometimes, however, local grids are defined by an origin in easting/northing (origin_1), a rotation, a scale, and an origin for the local grid (origin_2). In these cases you can use the following formulas (which were derived by matrix multiplication) to compute the corresponding affine parameters:

r = -rotation
A = scale * cos(r)
B = -scale * sin(r)
C = scale * ( -x_origin_1 * cos(r) + y_origin_1 * sin(r) + x_origin_2 )
D = scale * sin(r)
E = scale * cos(r)
F = scale * ( -x_origin_1 * sin(r) - y_origin_1 * cos(r) + y_origin_2 )

Note that here a positive rotation angle results in the local grid coordinates being rotated clockwise, and a negative angle gives an anti-clockwise rotation.

For example, we wish to define a local grid based on the UTM projection. The origin of our local grid in UTM coordinates will be 300000 mE, and 6300000 mN, and we want the local grid to be rotated 45 degrees anti-clockwise (-45 degrees), scaled by 1.0, with a local grid origin of (1000,1000).

Using the above formulas we get the following values:
r = 45
A = 0.7071067
B = -0.7071067
C = 4243640.6
D = 0.7071067
E = 0.7071067
F = -4665904.7

So, for the UTM coordinate 323456 mE, 6312345 mN, this will give us a local grid coordinate of 8857 mE, 26315 mN.

If you have an Android phone and install our Custom Formulas app, you can download the files below, save them to your phone's storage under the CustomFormulas folder and import them into the app to easily perform the computations above:

www.binaryearth.net