Last active
May 5, 2020 15:10
-
-
Save henryrossiter/8000d83458514b6909613abf58ef71f7 to your computer and use it in GitHub Desktop.
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
function pythagoreanDistanceBetweenPoints(lat1, lon1, lat2, lon2) { | |
const R = 6371e3; | |
const x = (lon2-lon1) * Math.cos((lat1+lat2)/2); | |
const y = (lat2-lat1); | |
const d = Math.sqrt(x*x + y*y) * R; | |
return d; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment