10

我想使用雅虎查询通过纬度和经度获取一些天气数据。但似乎这个查询现在不可用。查询如下:

select * from weather.forecast where woeid in (SELECT woeid FROM geo.placefinder WHERE text="{lat},{lon}" and gflags="R")

此查询是否更改为新查询?还是它不存在了?我上次使用这种格式是在大约 2 个月前,而且效果很好。但现在它无法获取任何数据。YQL 控制台的结果如下:

{
 "error": {
  "lang": "en-US",
  "description": "Tenant 'query_yahooapis_com' access to 'Resource [tenantName=query_yahooapis_com, type=TABLE, name=geo.placefinder, locatorType=FILE, url=/home/y/share/manhattan/application/tenantBundles/yql_query_yahooapis_com_manhattan_v2/YQL-INF/restdefs/geo.placefinder.xml, useUrl=false]' is denied."
 }
}

我已经做了一些研究,包括这篇文章:How to get Yahoo's woeid by location?

雅虎已经终止了这个纬度经度查询以获取天气,这是真的吗?

4

2 回答 2

22

根据这个答案的最新回复,你应该切换到表格geo.places并删除gflags="R"部分。我在 YQL 控制台中尝试过,它似乎可以工作:

select * from weather.forecast where woeid in (SELECT woeid FROM geo.places WHERE text="(latitude,longitude)")
于 2016-02-17T10:54:11.420 回答
1

这对我有用(你应该切换到表 geo.places(1)):

...

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-01T11:43:21.727 回答