Bearing from coordinates formula

Bearing from coordinates formula is used for calculating bearing between two points with known coordinates (x and y).

According to the formula, bearing ϕ is:

$tan \phi P1 \rightarrow P2 = \left( \frac{y2-y1}{x2-x1} \right)$

A quadrant addition has to be added to get a correct bearing value. Positive or negative numbers in the nominator and denominator shows the quadrant.

First quadrant: $\left( \frac{+}{+} \right)$: nothing is added

Second quadrant: $\left( \frac{+}{-} \right)$: 200 grads is added

Third quadrant: $\left( \frac{-}{-} \right)$: 200 grads is added

Fourth quadrant: $\left( \frac{-}{+} \right)$: 400 grads is added

These quadrants are geodetic which means they are numbered clockwise, unlike mathematical quadrants which are numbered counterclockwise.

Figur|Figur

Example: Point P1 has coordinates x=20 and y=50. Point P2 has coordinates x=100 och y=120. Calculating bearing from P1 to P2:

$tan \phi P1 \rightarrow P2 = \left( \frac{120-50}{100-20} \right) \Rightarrow \phi = 45,76 grad$

Since both nominator and denominator has positive values this bearing is in first quadrant and nothing is added.

Calculating bearing from P2 to P1:

$tan \phi P2 \rightarrow P1 = \left( \frac{50-120}{20-100} \right) \Rightarrow \phi = 45,76 grad$

Since both nominator and denominator is negative this bearing is in third quadrant and 200 grads is added: ϕ = 45, 76 + 200 ⇒ ϕ = 245, 76grad