Hi everyone,
I'm glad that Google is now offering reverse geocoding.
However, I'm having, once in a while, an issue with the code in
Internet Explorer.
This was my code:
if (geocoder) { // reverse geocoding (Google Maps API)
geocoder.getLocations(lastMarker.getLatLng(), function(response)
{
var place = response.Placemark[0];
html+= '<br>' + 'Address: ' + place.address;
lastMarker.openInfoWindowHtml(html); // display the info window
(updated contents)
}
});
}
This is executed when I click on a marker (to display the
InfoWindow). Once in a while, I receive this error:
Error: 'Placemark.0' is null or not an object
I then changed my code to this:
if (geocoder) { // reverse geocoding (Google Maps API)
geocoder.getLocations(lastMarker.getLatLng(), function(response)
{
if (response.Status.code == 200) {
var place = response.Placemark[0];
html+= '<br>' + 'Address: ' + place.address;
lastMarker.openInfoWindowHtml(html); // display the info window
(updated contents)
} else {
alert('Sorry, the Google Maps API couldn\'t reverse geocode the
given lat/lng');
}
});
}
Now, with this code, I sometime receive this error (and the alert msg
afterward):
Error: Expected identifier, string or number
Both these errors refer to the JSON returned by Google.
I have those in Internet Explorer only... I've never seen them using
FireFox.
Has somebody experienced this before?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---