How to calculate the Azimuth angle between two points on the surface of the earth if i ONLY have the lat/long of them?
The first question is addressed at Bearing/Course/Heading in WGS84 ellipsoid model [since deleted by its asker] and How to Calculate North?. The second question does not have a "mathematical" solution in the sense of a formula because it requires a dataset showing magnetic north at all points of the earth.
Let's define an example with three points:
- p1 at 38.4°N 35.5°E
- p2 at 22.1°N 78.9°E.
- 2007 North Magnetic Pole at 83.95°N 120.72°W
To calculate the azimuth angle between each coordinate pair, you can use GeographicLib, for example the online tool. Find the
fazi1 azimuth from the inverse geodesic to get the forward azimuth from p1 to the second point:
So the absolute difference between these two azimuths should be the angle you are looking for, 103.76106083. And again, this is the angle between MP and p2 as "viewed" from p1.
Sorry i forgot the question, even I had it's answer couple of days after i had posted it.
I quote from it:
var φ1 = this.lat.toRadians(), φ2 = point.lat.toRadians(); var Δλ = (point.lon-this.lon).toRadians(); var y = Math.sin(Δλ) * Math.cos(φ2); var x = Math.cos(φ1)*Math.sin(φ2) - Math.sin(φ1)*Math.cos(φ2)*Math.cos(Δλ); var θ = Math.atan2(y, x); return (θ.toDegrees()+360) % 360;
where φ is Lat, λ is Long , both in Degrees.
About the second question:
All of the past equations are relative to the true north, and we know there is the
Declination part which is - as Wikipedia says:
Magnetic declination or variation is the angle on the horizontal plane between magnetic north and true north
I've found here the application to calculate the magnetic declination using the point lat/long, attitude, and the year to calculate the declination.
It gives you the declination from the data set of
World Magnetic Model (of 2015 apparently).
For example, using the software:
At my location at year 2017 and attitude of 600 meters the declination is around 4.8 degrees to the East and this is the deference between true north and magnetic north in my area, in other words if i had a compass it would point to 4.8 degrees to the east of true geographic north.