1

I am trying to develop a program for my ship in order to be able to know what is the azimut of the ships around him. Yet, I don't know how to calculate the azimut given my own position which is the first latitude-longitude couple and the "enemy" position.

For instance, being in $47°59'N,1°44W$ and watching an aircraft carrier in $47°23'N,1°12E$, how may I found the azimut of the aircraft carrier from my own position?

Can you help me figuring it out?

A sub question would be about calculating its distance, it is like calculating the distance between two points. Yet, it is in degree, minutes and seconds...

1 Answers1

1

enter image description here

There is a spherical trigonometric formula that gives $\tan(\text{Bearing})$ as $$ \frac{\cos(\text{Latitude B})\sin(\Delta\text{Longitude})}{\cos(\text{Latitude A})\sin(\text{Latitude B})-\sin(\text{Latitude A})\cos(\text{Latitude B})\cos(\Delta\text{Longitude})}\tag{1} $$ The Spherical Law of Cosines gives $\cos(\text{Distance})$ as $$ \sin(\text{Latitude A})\sin(\text{Latitude B})+\cos(\text{Latitude A})\cos(\text{Latitude B})\cos(\Delta\text{Longitude})\tag{2} $$ Once we have computed the Distance, we can use the Spherical Law of Sines to compute $$ \sin(\text{Bearing})=\frac{\sin(\Delta\text{Longitude})\cos(\text{Latitude B})}{\sin(\text{Distance})}\tag{3} $$ Equation $(3)$ will remove any uncertainty in the quadrant of Bearing as computed in $(1)$.

Using the Spherical Law of Cosines, we can also compute $$ \cos(\text{Bearing})=\frac{\sin(\text{Latitude B})-\sin(\text{Latitude A})\cos(\text{Distance})}{\cos(\text{Latitude A})\sin(\text{Distance})}\tag{4} $$ Note that $(2)$, $(3)$, and $(4)$ can be combined to obtain $(1)$.

robjohn
  • 345,667
  • Thank you! But is $\tan (Bearing)$ my target azimut? – Revolucion for Monica Aug 04 '16 at 06:48
  • And do you take into account that somebody can be East and the other West? – Revolucion for Monica Aug 04 '16 at 07:06
  • The Bearing is your azimuth. $\sin(\text{Bearing})$ has the same sign as $\sin(\Delta\text{Longitude})$. This will get the proper quadrant. – robjohn Aug 04 '16 at 13:07
  • Okay, for instance if I have $(0° 0,0' N, 0° 0,0' E)$ and $(1° 0,0' S, 1° 0,0' E)$ I will have an $azimuth = 122,70$. Yet, I found on http://www.dcode.fr/azimut a calculator using this forula: $azimuth = \operatorname{atan2} (y, x)=2 \arctan rac{y}{\sqrt{x^2+y^2}+x}$ with $x = \cos(lat_1) * \sin(lat_2) - \sin(lat_1)\cos(lat_2)\cos(long_2-long_1) $ and $y = \sin(long_2-long_1)*\cos(lat_2)$. Which gives me $ 135.00436354466$.Why is it different? – Revolucion for Monica Aug 26 '16 at 08:48
  • Furthermore if $Latitude A = Latitude B = 0$, this formula doesn't work as far as $\cos(\text{Latitude A})\sin(\text{Latitude B})-\sin(\text{Latitude A})\cos(\text{Latitude B})\cos(\Delta\text{Longitude}) = 0$ – Revolucion for Monica Aug 26 '16 at 09:23
  • Then $\tan(\text{Bearing})=\infty$, or $\text{Bearing}=\pm\frac\pi2$. I have added a couple of equations that should make it possible to determine the quadrant of Bearing. – robjohn Aug 26 '16 at 15:53
  • Given your data, $(1)$ gives $\tan(\text{Bearing})$ to be $-0.999847695$, which means either $-44.99563646^\circ$ or $135.00436354^\circ$. $(3)$ says that $\sin(\text{Bearing})\gt0$, which means that the Bearing is $135.00436354^\circ$. – robjohn Aug 26 '16 at 16:09