经纬度雅虎天气查询

Yahoo Weather Query by Latitude and Longitude

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

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."
 }
}

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

雅虎是否已经终止了获取天气的经纬度查询?

根据this answer的最新回复,您应该切换到table geo.places 并删除gflags="R" 部分。 我在 YQL 控制台中尝试过,它似乎有效:

select * from weather.forecast where woeid in (SELECT woeid FROM geo.places WHERE text="(latitude,longitude)")

这对我有用(你应该切换到 table 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());