83
rated 0 times
[
90]
[
7]
/ answers: 1 / hits: 44505
/ 10 Years ago, fri, march 28, 2014, 12:00:00
I am able to get get full address from current latitude and longitude. but how can I get only city name from full address. this is my code.
var geocoder;
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(latitude, longitude);
//alert(Else loop + latlng);
geocoder.geocode({
'latLng': latlng
}, function(results, status) {
//alert(Else loop1);
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
var add = results[0].formatted_address;
alert(Full address is: + add);
} else {
alert(address not found);
}
} else {
//document.getElementById(location).innerHTML=Geocoder failed due to: + status;
//alert(Geocoder failed due to: + status);
}
});
More From » android