Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Yahoo's woeid by location? [closed]

// Get woeid by lati/long
            HttpGet hg = new HttpGet(
                        "http://where.yahooapis.com/geocode?location=" + latlon + "&flags=J&gflags=R)");
            HttpClient hc = new DefaultHttpClient();
            HttpResponse weatherHR = hc.execute(hg);

            if (weatherHR.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                if (DEBUG)
                    Utils.log("", "Location != HttpStatus.SC_OK");
                return null;
            }

I used this API and it work ok before, but It return a error since today, the HttpStatus.SC_OK is not OK. Has this API been closed? Thanks.

like image 529
herbertD Avatar asked Apr 03 '13 09:04

herbertD


3 Answers

Yahoo has moved to paid service called BOSS but they do offer a non-commercial service:

Non-Commercial usage of Yahoo Geo API's

Yahoo! continues to fully support developer applications built on top of Placefinder and PlaceSpotter in non-commercial settings. Both services are available to you via YQL and rate limited to 2000 queries per table. Learn more about using the Placefinder and Placespotter YQL tables.

Using Placefinder you can reverse lookup a latitude and longitude:

http://developer.yahoo.com/yql/console/?q=select%20*%20from%20geo.placefinder%20where%20text%3D%2237.416275%2C-122.025092%22%20and%20gflags%3D%22R%22

which can be converted into a json request:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%2237.416275%2C-122.025092%22%20and%20gflags%3D%22R%22&format=json

like image 122
Cas Avatar answered Oct 20 '22 22:10

Cas


Yes, it's closed, give a look here: http://soup.metwit.com/post/47181933854/an-alternative-to-yahoo-weather-api

like image 28
beddamadre Avatar answered Oct 20 '22 20:10

beddamadre


A city can also be used as location as follows:

select * 
from weather.forecast 
where woeid in (
    select woeid 
    from geo.places(1) 
    where text="frankfurt"
) and u="c"

Where "frankfurt" can be replaced with any location of choice.

like image 23
Istvan Avatar answered Oct 20 '22 20:10

Istvan