Yahoo Weather API WOEID retrieval

本小妞迷上赌 提交于 2019-11-28 03:41:37

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)

NguyenDat

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]

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!