Created
December 22, 2017 18:41
-
-
Save cedced19/620b8364fb566aed672da20e1ecd16ec to your computer and use it in GitHub Desktop.
Get coordinates received from Warn Family app.
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
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