Google Weather API is something I discovered today. I wanted to add a weather lookup feature to the Plurk bot I've been developing recently, so I searched online for ways to get weather data. My original plan was to read the Central Weather Bureau's web pages and parse the data there. But then I found that both Google and Yahoo offer weather APIs. I preferred the Google Weather API, because it returns XML, which is easier to parse. Yahoo, on the other hand, returns HTML... Also, the Google Weather API lets you specify a city name directly. For example, if I want the weather for Taipei City, I just pass "Taipei" to the API. Yahoo's weather API isn't that simple, though. You have to enter a city code, which means I'd need to look up the code for the city I want before I could use Yahoo's API.

Google Weather API Features

  • You can search by city name (in Chinese or English)
  • You can search by latitude and longitude
  • Returns a full week of data, including high and low temperatures and cloud cover
  • The data is returned as XML, encoded in Big5

Google Weather API Format

http://www.google.com/ig/api?hl=zh-tw&weather=city_name

Enter the city name or the latitude and longitude you want to query in city_name.

e.g., checking the weather in Taipei

http://www.google.com/ig/api?hl=zh-tw&weather=Taipei

PHP Example

Sample file download: Xun6 |4Shared | Box.net