karthika pommudu

karthika pommudu

  • NA
  • 321
  • 34.4k

Can anyone help to find this..

Jan 23 2019 11:58 PM
Here I want the location address from  latitude longitude ..thanks by advance
 
 
function calcRoute() {
var start = document.getElementById('origin').value;
var end = document.getElementById('destination').value;
var request = {
origin: start,
destination: end,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
if (response.routes && response.routes.length > 0) {
var routes = response.routes;
for (var j = 0; j < routes.length; j++) {
var points = routes[j].overview_path;
var ul = document.getElementById("vertex");
for (var i = 0; i < points.length; i++) {
var li = document.createElement('li');
li.innerHTML = getLiText(points[i]);
ul.appendChild(li);
}
}
}
}
});
}
function getLiText(point) {
var lat = point.lat(),
lng = point.lng();
///////
var lat ;
var lng ;
var point = new google.maps.LatLng(lat, lng);
var geocoder = new google.maps.Geocoder();
geocoder.geocode({latLng: point}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
infoWindow.setContent(results[1].formatted_address);
infoWindow.setPosition(point);
infoWindow.open(map);
}
}
});
//////////////////
return "lat: " + lat + " lng: " + lng;
}

Answers (2)