This function here is the right one. It returns pretty same results as the Google Maps distance, which leads me to believe that it's kind of correct.
I've seen a lot of ready solutions online for the same input/output/platform combination (i.e. WGS84 degrees input/output on MySQL), but all of them used some other formula (at the end multiplying by 1.1515) that was producing some results that never worked for me.
On the other hand the following formula returns results identical with what Google Maps returns.
I've seen a lot of ready solutions online for the same input/output/platform combination (i.e. WGS84 degrees input/output on MySQL), but all of them used some other formula (at the end multiplying by 1.1515) that was producing some results that never worked for me.
On the other hand the following formula returns results identical with what Google Maps returns.
My function output 
Cross check 
Apparently there's some issue with the bearing and that's why the result is still not precisely accurate, but it's much closer than the other methods' outputs I've tried before.
