How to calculate the Azimuth angle between two points on the surface of the earth if i ONLY have the lat/long of them?
Here is an example image: the azimuth angle is X which i want to calculate AND the angle to the magnetic pole.
How to calculate the Azimuth angle between two points on the surface of the earth if i ONLY have the lat/long of them?
Here is an example image: the azimuth angle is X which i want to calculate AND the angle to the magnetic pole.
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.
Sorry i forgot the question, even I had it's answer couple of days after i had posted it.
In that time i was searching for a formula to give the same results as the heading between two points in Google Earth, which I've found here ( first answer on Google ) , it has a lot of Math formulas for a lot of problems (distance,bearing,intersections of path... etc) along with google maps examples for most of the cases. AND Javascript source code for each one.
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.
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.
Let's define an example with three points:
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.