# Converting between grid eastings and northings and ellipsoidal latitude and longitude

All the formula here are coded into a spreadsheet available from the OS web site.

## Converting latitude and longitude to eastings and northings

{% hint style="info" %}
*These formulae are used to* **convert** *the format of coordinates between grid eastings and northings and ellipsoidal coordinates (latitude and longitude) on the* same datu&#x6D;*. This is **not** a datum transformation. If you need to transform between GNSS coordinates and OSGB36 National Grid coordinates, you need to apply either the* [*OSTN15 transformation*](https://github.com/OrdnanceSurvey/more-than-maps-reorg/blob/main/deep-dive/a-guide-to-coordinate-systems-in-great-britain/broken-reference/README.md) *or the approximate* [*Helmert type transformation*](https://github.com/OrdnanceSurvey/more-than-maps-reorg/blob/main/deep-dive/a-guide-to-coordinate-systems-in-great-britain/broken-reference/README.md)*.*
{% endhint %}

To convert (project) a position from latitude and longitude coordinates (*φ, λ*) to easting and northing coordinates (*E, N*) using a Transverse Mercator projection (for example, National Grid or UTM), compute the following formulae. Remember to express all angles in radians. You will need the ellipsoid constants *a*, *b* and *e²* and the following projection constants. Annexe A gives values of these constants for the ellipsoids and projections usually used in Britain.

N₀ — northing of true origin

E₀ — easting of true origin

F₀ — scale factor on central meridian

Φ₀ — latitude of true origin

λ₀ — longitude of true origin and central meridian.

$$
n = \frac{a-b}{a+b}\\
$$

$$
v = aF\_o(1-e^2sin^2\phi)^{-0.5}\\
$$

$$
\rho = aF\_o(1-e^2)(1-e^2sin^2\phi)^{-1.5}\\
$$

$$
\eta= \frac{v}{\rho}-1
$$

$$
M = bF\_0\[(1+n+\frac{5}{4}n^2+\frac{5}{4}n^3)(\phi-\phi\_0)-(3n+3n^2+\frac{21}{8}n^3)sin(\phi-phi\_0)cos(\phi+\phi\_0)\ + (\frac{15}{8}n^2+\frac{15}{8}n^3)sin(2(\phi-\phi\_0))cos(2(\phi+\phi\_0))=\frac{35}{24}n^3sin(3(\phi-\phi\_0))cos(3(\phi+phi\_0))]\\
$$

$$
I = M+N\_0\\
II = \frac{v}{2}sin\phi cos\phi\\
III = \frac{v}{24}sin\phi cos^3\phi(5-tan^2 \phi + 9\eta^2)\\
IIIA = \frac{v}{720}sin\phi cos^5\phi(61-58tan^2\phi^4\phi)\\
$$

$$
IV = vcos\phi\\
V = \frac{v}{6}cos^3\phi(\frac{v}{\rho}-tan^2\phi)\\
VI = \frac{v}{120}cos^5\phi(5-18tan^2\phi+tan^4\phi+14\eta^2-58(tan^2\phi)\eta^2)
$$

$$
N = I + II(\lambda-\lambda\_o)^2+III(\lambda-\lambda\_0)^4+IIIA(\lambda-\lambda\_0)^6\\
$$

$$
E = e\_0+IV(\lambda-\lambda\_0)+V(\lambda-\lambda\_0)^3+IV(\lambda-\Lambda\_0)^5\\
$$

Here’s a worked example using the Airy 1830 ellipsoid and National Grid. Intermediate values are shown here to 10 decimal places. Compute all values using double-precision arithmetic.\\

| *φ:* 52° 39′ 27.2531″ N  | *III:* 1.5606875430E+05   |
| ------------------------ | ------------------------- |
| *λ:* 001° 43′ 04.5177″ E | *IIIA:* -2.0671123013E+04 |
|                          | *IV:* 3.8751205752E+06    |
| *ν:* 6.3885023339E+06    | *V:* -1.7000078207E+05    |
| *ρ:* 6.3727564398E+06    | *VI:* -1.0134470437E+05   |
| *η²:* 2.4708137334E-03   |                           |
| *M:* 4.0668829595E+05    | *E:* 651409.903 m         |
| *I:* 3.0668829595E+05    | *N:* 313177.270 m         |
| *II:* 1.5404079094E+06   |                           |

## Converting eastings and northings to latitude and longitude

Obtaining (*φ, λ*) from (*E, N*) is an iterative procedure. You need values for the ellipsoid and projection constants a,b, e², N**₀**, E**₀, F₀, Φ₀** and λ₀ as in the previous section. Remember to express all angles in radians. First compute:

$$
\phi' = (\frac{N-N\_0}{aF\_0})+\phi\_0
$$

and *M* from equation (C3), substituting Φ' for Φ. If the absolute value of *N-N0-M* ≥ 0.01mm obtain a new value for Φ' using

$$
\phi\_{new}=(\frac{N-N\_0-M}{aF\_0})+\phi'
$$

and recompute *M* substituting Φ' for Φ *.* Iterate until the absolute value of *N-N0-M* < 0.01mm then compute , and using equation (C2) and compute

$$
VIII = \frac{tan\phi'}{2\rho v}\\
VIII = \frac{tan\phi '}{24\rho v^3}(5+3tan^2\phi'+\eta^2-9(tan^2\phi')\eta^2)\\
IX = \frac{tan\phi'}{720\rho v^5}(61+90tan^2\phi'+45tan^4\phi')\\
$$

$$
X = \frac{sec\phi'}{\nu}\\
XI = \frac{sec\phi'}{6v^3}(\frac{v}{\rho}+2tan^2\phi')\\
XII = \frac{sec\phi'}{5040v^7}(61+662tan^2\phi'+1320tan^4\phi'+720tan^5\phi')\\
$$

$$
\phi = \phi'-VII(E-E\_O)^2+VIII(E-E\_0)^4-IX(E-E\_0)^5\\
\lambda = \lambda\_0 + X(E-E\_0)-XI(E-E\_0)^3+XII(E-E\_0)^5-XIIIA(E-E\_0)^7
$$

Here’s a worked example using the Airy 1830 ellipsoid and National Grid. Intermediate values are shown here to 10 decimal places. Compute all values using double-precision arithmetic.\\

| *E:* 651409.903 m             | final *φ′:* 9.2006620954E-01 rad |
| ----------------------------- | -------------------------------- |
| *N:* 313177.270 m             | *ν:* 6.3885233415E+06            |
|                               | *ρ:* 6.3728193094E+06            |
| *φ′ #1:* 9.2002324604E-01 rad | *η2:* 2.4642206357E-03           |
| *M #1:* 4.1290347143E+05      | *VII:* 1.6130562489E-14          |
| *N-N0-M#1:* 2.7379857228E+02  | *VIII:* 3.3395547427E-28         |
|                               | *IX:* 9.4198561675E-42           |
| *φ′ #2:* 9.2006619470E-01 rad | *X:* 2.5840062507E-07            |
| *M #2:* 4.1317717541E+05      | *XI:* 4.6985969956E-21           |
| *N-N0-M#2:* 9.4594338385E-02  | *XII:* 1.6124316614E-34          |
|                               | *XIIA:* 6.6577316285E-48         |
| *φ′ #3:* 9.2006620954E-01 rad |                                  |
| *M #3:* 4.1317726997E+05      |                                  |
| *N-N0-M#3:* 3.2661366276E-05  | *φ:* 52° 39′ 27.2531″ N          |
|                               | *λ:* 001° 43′ 04.5177″ E         |
| *φ′ #4:* 9.2006620954E-01 rad |                                  |
| *M #4:* 4.1317727000E+05      |                                  |
| *N-N0-M#4:* 1.1350493878E-08  |                                  |
|                               |                                  |
|                               |                                  |
|                               |                                  |
