Created
September 16, 2014 07:25
-
-
Save jefsnare/3c6ac2263045bf02602f to your computer and use it in GitHub Desktop.
Convert Google Maps API LatLng object to string/array
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 geocoder = new google.maps.Geocoder(); | |
geocoder.geocode({ 'address': '1071 CX, Amsterdam, NL' }, function (results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
var result = results[0], | |
latlng = result.geometry.location.toString().replace(/\(|\)/g, '').split(', ')); | |
console.log(latlng[0]); //lat | |
console.log(latlng[1]); //long | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment