使用 Yql 查询纬度、经度参数获取天气信息

发布于 2024-10-18 00:01:00 字数 366 浏览 8 评论 0原文

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

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

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

I am using the following YQL query to get weather information

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

Is there any way to get weather information using longitude, latitude as YQL query parameter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

锦上情书 2024-10-25 00:01:00

您可以使用子选择从纬度/经度对转到 WOEID< /a> 就像

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

在 YQL 控制台中尝试

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)

梦归所梦 2024-10-25 00:01:00

这对我有用:

……

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());

This works for me:

...

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

... and then:

query = String.format(query, location.getLatitude(), location.getLongitude());
哥,最终变帅啦 2024-10-25 00:01:00

我发现了一些有用的东西;如果您需要预测天气 yql 使用
SELECT * FROM Weather.bylocation WHERE location='印度尼西亚'
从 Weather.forecast 中选择 *,其中 location=90210

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文