Hi,
I have the below function which works well. It basically looks up
addresses and the province/state/emirate of an area and adds it to a
table using reverse geocoding.
I would also like to know if the latitude/longitude coordinates are in
a shopping mall and which shopping mall it is. I think it is possible
to get this information through google places but I have been trying
for the past 5 hours and I'm no further forward.
Is this possible? and if so could someone please show or provide an
example?
Thank you,
Current Function that works well:
function ReverseGeoCode(position, locfield) {
var input = (String(position));
var latlngStr = input.replace(/[\(\)]/g, "");
var latlngSplit = latlngStr.split(",",2);
var lat = parseFloat(latlngSplit[0]);
var lng = parseFloat(latlngSplit[1]);
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
// Adds address to the Location Field
address =
(results[0].formatted_address);
document.getElementById("Location" +
locfield).value = address;
var arrAddress =
results[0].address_components;
// Checks and adds the City Name if
available
for (var i=0; i<arrAddress.length; i++)
{
if (arrAddress[i].types[0] ===
"administrative_area_level_1") {
//Loop through the
dropdown and select the best match city
var optionchange =
document.getElementById("CityName" +
locfield);
for (c = 0; c <
optionchange.length; c++) {
if
(arrAddress[i].long_name === optionchange.options[c].value)
{
optionchange.options[c].selected = "selected";
}
}
}
}
} else {
document.getElementById("Location" +
locfield).value = "No
address found";
document.getElementById("CityName" +
locfield).value = "Select
City";
}
}
else {
document.getElementById("Location" +
locfield).value = "No address
found";
document.getElementById("CityName" +
locfield).value = "Select
City";
}
});
}
I am
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.