I want to get the full formatted address using the Google Maps API v3 Reverse Geocoding, since it only shows the zip code and / or city and country in many (possibly all) countries. I also want to get the street name and other things that you can get through the function Reverse geocoding (address search) . But since I cannot get data from XML files or addresses associated with the XML file in JavaScript, I have to use the Reverse Geocoding function .
Reverse geocoding (address search) shows 791 Long Ridge Lane, Gainesboro, Tennessee 38562, USAand reverse geocoding shows Gainesboro, Tennessee 38562, USA.
Is it possible to get the full formatted address even through reverse geocoding or do I need to use a PHP XML file through reverse geocoding (address search)?
function coordinates_to_address(lat, lng) {
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
if(results[1]) {
$('#address_current').text(results[1].formatted_address);
} else {
alert('No results found');
}
} else {
var error = {
'ZERO_RESULTS': 'Kunde inte hitta adress'
}
$('#address_new').html('<span class="color-red">' + error[status] + '</span>');
}
});
}
source
share