melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
220 stars 42 forks source link

Find correct north vector at a given navigation Cords (geolocation) #210

Open VrushalNCT opened 3 years ago

VrushalNCT commented 3 years ago

We're currently taking the NED matrix for geolocation(navigation cords)(map.getNED()) and using the third row from the matrix as the north direction.(Out of 16 values in matrix starting from 0, we're using 8th, 9th and 10th values as a north vector).

And this is working on few geolocations and for other navigation cords it is 180 deg off (i.e. it gives south direction) Lat : 2.9497867, Long : 34.907269 - For this one, it gives the correct North direction. Lat : 34.112000 Long : -117.957000 - For this one, it gives south direction.

Is the above method correct to find out the north vector from the NED matrix? Could you please suggest how to calculate a proper north direction at any given geolocation or navigation cords?