Getting Latitude and Longitude from Google Places search api using Javascript

function GetLatlong()
    {
        var geocoder = new google.maps.Geocoder();
        var address = document.getElementById('textboxid').value;

        geocoder.geocode({ 'address': address }, function (results, status) {

            if (status == google.maps.GeocoderStatus.OK) {
                var latitude = results[0].geometry.location.lat();
                var longitude = results[0].geometry.location.lng();

            }
        });

Credit:
https://stackoverflow.com/questions/20916221/getting-latitude-and-longitude-from-google-places-search-api-using-javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Share
Tweet
Pin
+1
Share
0 Shares