I write solutions to the problems I can't find much about elsewhere on the Web, also some code/script snippets that are absolutely awesome and make my life easier. Will be glad if someone finds these posts interesting and helpful!
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.