雅虎天气 API WOEID 检索

发布于 2024-08-13 04:39:41 字数 428 浏览 2 评论 0原文

我正在创建一个应用程序 (PHP),它从免费 RSS 源获取雅虎天气数据,并将其与基于从 RSS 源检索的数据的颜色十六进制相关联。我遇到的问题是找到一种无需手动操作即可获取位置代码或 WOEID 的方法。

只要您提供 WOEID,Yahoos API 就会发回 RSS 提要 -> http://weather.yahooapis.com/forecastrss?w=4097

是否存在道德规范这样做的方法?我的初学者知识告诉我,我必须编写一个脚本,使用该术语搜索雅虎并获取第一个 WOEID,但我假设雅虎不希望脚本执行此操作,而且它似乎过于复杂......如果没有,还有其他选择吗API 可以让我更轻松地完成这件事吗?

谢谢!

I'm creating an app (PHP) that takes yahoo weather data from the free RSS feed and correlates it with a colour hex based on data retrieved from the RSS feed. The issue I'm having is finding a way to grab the location code or WOEID without doing it manually.

Yahoos API sends back an RSS feed as long as you provide a WOEID -> http://weather.yahooapis.com/forecastrss?w=4097

Is there an ethical way of doing this? My beginner knowledge tells me I have to write a script that would search yahoo using the term and grab the first WOEID, but I would assume yahoo doesn't want scripts doing this and it seems overcomplicated... If not, are there any alternative APIs that would make this easier on me?

Thanks!

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

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

发布评论

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

评论(3

眉黛浅 2024-08-20 04:39:41

为什么不直接使用雅虎! GeoPlanet 服务将地点解析为 WOEID?或者使用 YQL 服务通过其表访问 GeoPlanet?

http://where.yahooapis.com/v1/places.q('Barrie CA')?appid=[yourappidhere]

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22Barrie%20CA%22&format=xml

无需刮擦。

干杯

G

(披露;我在 Yahoo! 工作,并且是 WOEID 和 GeoPlanet 背后团队的成员)

Why not just use the Yahoo! GeoPlanet service to resolve a place to a WOEID? Or use the YQL service to access GeoPlanet via it's table?

http://where.yahooapis.com/v1/places.q('Barrie CA')?appid=[yourappidhere]

or

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22Barrie%20CA%22&format=xml

No need for scraping.

Cheers

G

(Disclosure; I work for Yahoo! and am part of the group behind WOEIDs and GeoPlanet)

所有深爱都是秘密 2024-08-20 04:39:41

我从以下来源获得了一些有用的信息:
http://developer.yahoo.com/geo/geoplanet/

http://developer.yahoo.com/geo/geoplanet/guide/api- Reference.html#api-countries

  1. 查找重要地标的 WOEID:
    http://where.yahooapis.com/v1/places.q('sydney% 20opera%20house')?appid=[yourappidhere]

  2. 将 WOEID 解析到某个位置:
    http://where.yahooapis.com/v1/place/2507854?appid=[yourappidhere]

  3. 查找特定地点的 WOEID:
    http://where.yahooapis.com/v1/places.q('northfield% 20mn%20usa')?appid=[yourappidhere]

  4. 获取与给定地点匹配的一系列 WOEID,按最可能的顺序排序:
    http://where.yahooapis.com/v1/places.q('springfield' );start=0;count=5?appid=[yourappidhere]

  5. 查找给定 WOEID 的父级(并返回详细记录):
    http://where.yahooapis.com/v1/place/638242/parent?select=long&appid=[yourappidhere]

  6. 以特定语言(如果存在)返回给定 WOEID 的地名:
    http://where.yahooapis.com/v1/places.q('美国' )?lang=fr&appid=[yourappidhere]

  7. 获取 JSON 格式的地点表示:
    http://where.yahooapis.com/v1/place/2487956?format=json&appid=[yourappidhere]

  8. 要获取与特定 WOEID 相邻的地理位置列表:
    http://where.yahooapis.com/v1/place/12795711/neighbors?appid=[yourappidhere]

I got some useful information from:
http://developer.yahoo.com/geo/geoplanet/

And

http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html#api-countries

  1. Find the WOEID of a significant landmark:
    http://where.yahooapis.com/v1/places.q('sydney%20opera%20house')?appid=[yourappidhere]

  2. Resolve a WOEID to a place:
    http://where.yahooapis.com/v1/place/2507854?appid=[yourappidhere]

  3. Find the WOEID of a specific place:
    http://where.yahooapis.com/v1/places.q('northfield%20mn%20usa')?appid=[yourappidhere]

  4. Obtain a range of WOEIDs that match a given place, ordered by the most likely:
    http://where.yahooapis.com/v1/places.q('springfield');start=0;count=5?appid=[yourappidhere]

  5. Find the parent of a given WOEID (and return a detailed record):
    http://where.yahooapis.com/v1/place/638242/parent?select=long&appid=[yourappidhere]

  6. Return the Placename for a given WOEID in a specific language (where it exists):
    http://where.yahooapis.com/v1/places.q('usa')?lang=fr&appid=[yourappidhere]

  7. To obtain the representation of a place in JSON format:
    http://where.yahooapis.com/v1/place/2487956?format=json&appid=[yourappidhere]

  8. To obtain a list of geographies that neighbor a specific WOEID:
    http://where.yahooapis.com/v1/place/12795711/neighbors?appid=[yourappidhere]

_畞蕅 2024-08-20 04:39:41

雅虎! Geo Technologies 很高兴地宣布 YQL 中提供 PlaceFinder 支持。 geo.placefinder 表允许用户通过 YQL 查询向 PlaceFinder 发出请求。新表提供了多种不同的方式来访问 PlaceFinder。可以使用 http 检索支持的请求和参数的描述://query.yahooapis.com/v1/public/yql?q...&appid=test。以下是一些示例:

使用自由格式输入格式对街道地址 (1600宾夕法尼亚大道,华盛顿特区) 进行地理编码:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%221600%20Pennsylvania%20Ave%2C%20Washington%2C%20DC%22&appid=test

使用多行输入格式对街道地址 (701 First Ave, Sunnyvale, CA 94089) 进行地理编码:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20line1%3D%22701%20First%20Ave%22%20and%20line2%3D%22Sunnyvale%2C%20CA%2094089%22&appid=test

对机场进行地理编码代码 (SFO):

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22sfo%22&appid=test

用法语对兴趣点 (POI) 进行地理编码:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22Eiffel%20Tower%22%20and%20lang%3D%22fr%22&appid=test

使用地理坐标进行反向地理编码:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%2237.416275%2C%20-122.025092%22%20and%20gflags%3D%22R%22&appid=test

使用解析的输入格式对街道地址 (701 First Ave, Sunnyvale, CA 94089) 进行地理编码:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20house%3D%22701%22%20and%20street%3D%22First%20Ave%22%20and%20city%3D%22Sunnyvale%22%20and%20state%3D%22CA%22%20and%20postal%3D%2294089%22&appid=test

确定最近的交叉街道和时区地址:

http://query.yahooapis.com/v1/public/yql?q=select%20line1%2C%20line2%2C%20line3%2C%20line4%2C%20cross%2C%20timezone%20from%20geo.placefinder%20where%20text%3D%22701%20First%20Ave%2C%20Sunnyvale%2C%20CA%22%20and%20flags%3D%22T%22%20and%20gflags%3D%22C%22&appid=test

此示例说明了 YQL 从响应中仅选择指定字段的能力

Yahoo! Geo Technologies is pleased to announce the availability of PlaceFinder support in YQL. The geo.placefinder table allows users to make requests to PlaceFinder via YQL queries. The new table provides several different ways to access PlaceFinder. A description of the supported requests and parameters can be retrieved using http://query.yahooapis.com/v1/public/yql?q...&appid=test. Here are a few examples:

Geocoding a street address (1600 Pennsylvania Ave, Washington, DC) using free-form input format:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%221600%20Pennsylvania%20Ave%2C%20Washington%2C%20DC%22&appid=test

Geocoding a street address (701 First Ave, Sunnyvale, CA 94089) using multi-line input format:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20line1%3D%22701%20First%20Ave%22%20and%20line2%3D%22Sunnyvale%2C%20CA%2094089%22&appid=test

Geocoding an airport code (SFO):

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22sfo%22&appid=test

Geocoding a point of interest (POI) in French:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22Eiffel%20Tower%22%20and%20lang%3D%22fr%22&appid=test

Reverse geocoding using geographic coordinates:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%2237.416275%2C%20-122.025092%22%20and%20gflags%3D%22R%22&appid=test

Geocoding a street address (701 First Ave, Sunnyvale, CA 94089) using parsed input format:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20house%3D%22701%22%20and%20street%3D%22First%20Ave%22%20and%20city%3D%22Sunnyvale%22%20and%20state%3D%22CA%22%20and%20postal%3D%2294089%22&appid=test

Determining the nearest cross streets and timezone for an address:

http://query.yahooapis.com/v1/public/yql?q=select%20line1%2C%20line2%2C%20line3%2C%20line4%2C%20cross%2C%20timezone%20from%20geo.placefinder%20where%20text%3D%22701%20First%20Ave%2C%20Sunnyvale%2C%20CA%22%20and%20flags%3D%22T%22%20and%20gflags%3D%22C%22&appid=test

This example illustrates the YQL ability to select only specified fields from the response

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