使用Yql query lat,long parms获取天气信息

时间:2011-02-17 09:35:36

标签: yql yahoo-weather-api

我正在使用以下YQL查询来获取天气信息

http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json

有没有办法使用经度,纬度作为YQL查询参数来获取天气信息。

3 个答案:

答案 0 :(得分:2)

您可以使用子选择从纬度/经度对转到WOEID

SELECT * FROM weather.woeid 
WHERE w IN (
    SELECT place.woeid 
    FROM flickr.places(1) 
    WHERE (lat,lon) in (55.948503,-3.198931)
);

Try in YQL console

答案 1 :(得分:0)

这对我有用:

...

query = "SELECT * FROM weather.forecast " +
            "WHERE woeid in (" +
            "SELECT woeid " +
            "FROM geo.places(1) " +
            "WHERE text=\"(%1$s,  %2$s)\") " +
            "AND u='c'";

...然后:

query = String.format(query, location.getLatitude(), location.getLongitude());

答案 2 :(得分:-1)

我发现有些东西使用了ful;如果你需要预测天气yql使用了 SELECT * FROM weather.bylocation WHERE location ='Indonesia' select * from weather.forecast where location = 90210