Created
February 24, 2014 21:20
-
-
Save Kaapiii/9197377 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Basic Example of using Google Geocoding API | |
| var lat; | |
| var lng; | |
| function getLocationFromAdress(address){ | |
| var geoCoder = new google.maps.Geocoder(); | |
| var address = "Unterdorfstrasse 2, 3612 Steffisburg" | |
| geoCoder.geocode({ 'address': address }, function(results, status){ | |
| if(status == google.maps.GeocoderStatus.OK){ | |
| for (var i = 0; i < results.length; i++){ | |
| var lat = results[i].geometry.location.lat(); | |
| var lng = results[i].geometry.location.lng(); | |
| console.log("Lat: " + lat +" Lng: " + lng); | |
| } | |
| }else{ | |
| console.log("Adress search request faild."); | |
| } | |
| }); | |
| } | |
| getLocationFromAdress(address); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment