reverseGeolocation - parts of address undefined
Using code like herunder (where p is the location returned from getCurrentPosition), street and houseNumber remain undefined, while city and country are returned correctly. Anyone?
Nico Witteman, Amsterdam
=====================
var SEARCH = new ovi.mapsapi.search.Manager();
SEARCH.addObserver("state", function(observedManager, key, value){
if (value == "finished") {
if (observedManager.locations.length > 0) {
if (observedManager.locations[0].address.street) {
document.getElementById("lblStreet").innerHTML = observedManager.locations[0].address.street;
}
if (observedManager.locations[0].address.city) {
document.getElementById("lblCity").innerHTML = observedManager.locations[0].address.city;
}
if (observedManager.locations[0].address.houseNumber) {
document.getElementById("lblHouseNumber").innerHTML = observedManager.locations[0].address.houseNumber;
}
if (observedManager.locations[0].address.country) {
document.getElementById("lblCountry").innerHTML = observedManager.locations[0].address.country;
}
}
}
else
if (value == "failed")
alert("The automatically triggered search request in the Search example failed.");
});
alert(p.coords.latitude);
alert(p.coords.longitude);
var loc = new ovi.mapsapi.geo.Coordinate(p.coords.latitude, p.coords.longitude);
SEARCH.reverseGeocode(loc);
SEARCH.clear();
Re: reverseGeolocation - parts of address undefined
I would suspect that not all fields on the result necessarily have values, thus on some results the street and houseNumber can really be undefined, and wit some other queries, you might find other fields being also undefined.
Also , is that API from the Map for the Web APIs ? I suspect that they are really not designed to be used with WRT Widgets in general.