Tip: Working European Reverse Geocoder
Since the reverse geocoder seems to fail on EU adresses, I implemented the Google Reverse Geocoder.
Just as a tip to others, this might be useful:
function ownrgeocode(lat,lng){
var url="http://maps.google.com/maps/api/geocode/json?latlng="+lat+","+lng+"&sensor=true";
xhr = Titanium.Network.createHTTPClient();
xhr.open('GET',url);
Ti.API.info('>>> go get data for Rgeocode! ...URL: '+url);
xhr.onload = function(){
var json = this.responseText;
var gotitems = eval('(' + json + ')');
Ti.API.info('>ADR found:'+ gotitems.results[0].formatted_address);
adrlabel.text=gotitems.results[0].formatted_address;
}
xhr.send();
}
Btw, the reverse geocoder is also missing from the docs.
2 Answers
-
I am using Titanium.Yahoo.yql and it works great, even in Europe. :-)
My example to find the WOEID for the current or a given location:
Titanium.Yahoo.yql('select * from yahoo.maps.findLocation where q="'+latitude+','+longitude+'" and gflags="R"',function(e) { var woeid = e.data.ResultSet.Results.woeid; Titanium.API.info(woeid); });
-
Thanks, this solution works great!