Skip to content

Instantly share code, notes, and snippets.

@marcelitocs
Created June 26, 2017 18:34
Show Gist options
  • Save marcelitocs/4890686dbd13a3b8bba70995a3d0048f to your computer and use it in GitHub Desktop.
Save marcelitocs/4890686dbd13a3b8bba70995a3d0048f to your computer and use it in GitHub Desktop.
Função que retorna a distância em metros entre coordenadas (latitude e longitude)
let distanceBetweenCoordinates = function(p1, p2){
// distância em metros
return Math.sqrt(Math.pow(p1.latitude - p2.latitude, 2) + Math.pow(p1.longitude - p2.longitude, 2)) * 111.319 * 1000;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment