Itβs easy to figure out the scale factor, just select any two points and find the distance between them in the XY space and the WGS84 space, and the ratio between them is your scaling factor.
Rotations and translations are a bit more complicated, but not so difficult when you learn that the result of applying any number of rotations or translations (in only 2 dimensions!) Can be reduced to one rotation around some unknown point at some unknown angle.
Suddenly, you have N points to determine the three unknowns, the axis of rotation (x and y coordinates) and the angle of rotation.
The rotation calculation is as follows:
Pr = R*(Pxy - Paxis_xy) + Paxis_xy
Pr is your rotated point in XY space, which then needs to be converted to WGS84 space (if the axes of your coordinate systems are different).
R is a familiar rotation matrix depending on the rotation angle.
Pxy is your undamped point in the XY space.
Paxis_xy - axis of rotation in XY space.
To actually find the 3 unknowns, you need to expand your WGS84 points (or, respectively, scale your XY points) using the scaling factor you found, and shift the points so that the two coordinate systems have the same origin.
First we find the rotation angle: take two corresponding pairs of points P1, P1' and P2, P2' and write
P1' = R(P1-A) + A P2' = R(P2-A) + A
where I abbreviated A = Paxis_xy for short. Subtraction of two equations gives:
P2'-P1' = R(P2-P1) B = R * C Bx = cos(a) * Cx - sin(a) * Cy By = cos(a) * Cx + sin(a) * Cy By + Bx = 2 * cos(a) * Cx (By + Bx) / (2 * Cx) = cos(a) ... (By - Bx) / (2 * Cy) = sin(a) a = atan2(sin(a), cos(a)) <-- to get the right quadrant
And you have your own angle, you can also quickly check that cos(a) * cos(a) + sin(a) * sin(a) == 1 , to make sure that you correctly corrected all the calculations or that your system really is an orientation-preserving isometry (consists of translations and rotations only).
Now that we know a , we know R and therefore find a :
P1` = R(P1-A) + A P1' - R*P1 = (IR)A A = (inverse(IR)) * (P1' - R*P1)
where the inversion of the 2x2 matrix is ββsimple .
EDIT . In the case above, there is an error, or more specifically, one case that needs to be handled separately.
There is one combination of translations and rotations that cannot be reduced to one rotation, and this is one translation. You can think about it in terms of fixed points (how many points have not changed after the operation).
The translation has no fixed points (all points are changed), and rotation has 1 fixed point (the axis does not change). It turns out that two turns leave 1 fixed point, and translation and rotation leave 1 fixed point, which (with a little proof, which indicates that the number of fixed points informs you of the operation performed), is the reason that arbitrary combinations of them lead to one rotation.
This means that if your angle is expressed as 0 , then using the above method will also give you A = 0 , which is probably incorrect. In this case, you must do A = P1' - P1 .