1

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

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

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

4

3 回答 3

2

You could use a sub-select to go from a latitude/longitude pair to a WOEID like

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)

于 2011-02-19T14:50:36.127 回答
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());
于 2018-08-01T09:12:59.500 回答
-1

I have found some thing use ful; if you need to forcast weather yql use the SELECT * FROM weather.bylocation WHERE location='Indonesia' select * from weather.forecast where location=90210

于 2013-04-26T10:45:38.887 回答