Skip to content

Instantly share code, notes, and snippets.

@cedced19
Created December 22, 2017 18:41
Show Gist options
  • Save cedced19/620b8364fb566aed672da20e1ecd16ec to your computer and use it in GitHub Desktop.
Save cedced19/620b8364fb566aed672da20e1ecd16ec to your computer and use it in GitHub Desktop.
Get coordinates received from Warn Family app.
var txt = 'Je suis actuellement aux coordonnées GPS suivante: 48.6597597 7.21657276 https://www.google.fr/maps/place/48.6597597+7.21657276'
function getCoords (txt) {
var arr = txt.split(':')[1].replace('https', '').split(' ');
arr.forEach(function (i, k) {
if (i=='') arr.splice(k, 1);;
});
return {lat: arr[0], long: arr[1]};
}
console.log(getCoords(txt));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment