Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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.

— asked April 25th 2010 by Martijn Pannevis
  • geocode
  • google
  • mobile
  • reverse
1 Comment
  • Cool. This returns what I wanted. Works on Android. Did not check on iPhone yet. Thanks for the share.

    — commented August 7th 2012 by Ishara Amarasekera

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);
    });
    
    — answered July 11th 2010 by Dominik Hahn
    permalink
    3 Comments
    • Sounds cool! But what do I do with the woeid number that is returned with this query?

      — commented March 30th 2011 by James -
    • Never mind. Realized it was only on of the items returned. Fix it! This was awesome! Thank you Dominik!

      — commented March 30th 2011 by James -
    • This works really well, thanks

      — commented June 18th 2011 by Tom Campbell
  • Thanks, this solution works great!

    — answered July 11th 2010 by Xiao Jin
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.