Google weather API only supports querying by zip code in the United States. For example:
Http://www.google.com/ig/api? Hl = ZH-CN & weather = 94043
(94043 is the zip code of Mountain View city, California, USA)
In addition to the United States, you must use latitude and longitude coordinates as parameters to execute the Google weather API. For example:
Http://www.google.com/ig/api? Hl = ZH-CN & weather =, 3067133, 104019996
(3067213,10409706 is the longitude and latitude coordinates of Chengdu and mainland China)
Of course, you may also query the city name in Chinese pinyin. For example, the following is the weather in Beijing.
Http://www.google.com/ig/api? Weather = Beijing
You can use the country code list provided by Google API and the corresponding city longitude and latitude coordinates list to query the longitude and latitude coordinates of other regions. The following are the query parameters provided by Google API:
Http://www.google.com/ig/countries? Output = xml & HL = ZH-CN
(Query the code of all countries supported by Google and display it in ZH-CN Simplified Chinese)
Http://www.google.com/ig/cities? Output = xml & HL = ZH-CN & Country = Cn
Google opened a set of weather forecast API, which is still very useful.
Use zip code (USA)
Http://www.google.com/ig/api? Hl = ZH-CN & weather = 94043 (Mountain View city, California)
Use longitude and latitude coordinates
Http://www.google.com/ig/api? Hl = ZH-CN & weather =, 3067133, 104019996 (Chengdu)
Use the name of the connected city
Http://www.google.com/ig/api? Weather = Beijing & HL = ZH-CN (Beijing)
Http://www.google.com/ig/api? Weather = zhangka & HL = ZH-CN (Osaka)
Or
Http://www.google.com/ig/api? Weather = Beijing & HL = ZH (Beijing)
Http://www.google.com/ig/api? Weather = Osaka Ka & HL = JA (Osaka)
Which countries and cities can be found? Google also provides interfaces. The returned type can also be specified according to the output parameter.
Find country http://www.google.com/ig/countries? Output = xml & HL = ZH-CN (XML is returned)
Find city http://www.google.com/ig/cities? Hl = ZH-CN & Country = Cn (return JSON)
With this data, it is not difficult to add weather forecasts to your own applications.
Google's weather forecast API. The advantage is that you can directly obtain countries and cities that support weather query. In addition, the weather can be predicted for four days, and the weather can be queried by latitude and longitude (GPS can be used for this application ).
The downside is that few Chinese cities are supported. What specific can through http://www.google.com/ig/cities? Hl = ZH-CN & Country = cn query.
Certificate ----------------------------------------------------------------------------------------------------------------------------------
Yahoo weather API
The Yahoo weather forecast URL is
Http://weather.yahooapis.com/forecastrss? W = 2151330 & U = C (XML data is returned)
The meanings of the parameters are described as follows:
The parameter W corresponds to the woeid In the Yahoo database in various places. For example, the woeid in Beijing is 2151330. Currently, the parameter P can be used to replace w. However, W is recommended on the official website, it seems that P is planned to be canceled. Parameter U is used to determine the unit of temperature (C is degrees Celsius F is degrees Fahrenheit ). For weather queries in China (not comparable in foreign countries), Yahoo is relatively comprehensive in terms of both available and forecast content.
Get address number
The address number must be a woeid. You can query the address number you need on the Yahoo weather report homepage. This number is in
The URL of the city weather report you want. You can also enter your zip code in the homepage to query woeid. For example, if you want to query weather conditions in Guangzhou, the URL of the city's weather forecast page is
Http://weather.yahooapis.com/forecastrss? P = chxx0037 & U = C, so its woeid is 0037.
Here is a Yahoo weather report city code searched online: Yahoo weather report city code.
Yahoo weather developer: http://developer.yahoo.com/weather/
Advantages: no special advantages have been found. However, the city code I have collected is comprehensive (after all, I have not checked it ).
Disadvantage: only two days of weather can be predicted.
Supplement:
Woeid can be obtained through the following URL:
Http://query.yahooapis.com/v1/public/yql? Q = select % 20 * % 20 from % 20geo. Places % 20 where % 20 text % 3d % 22 Shanghai % 22 & diagnostics = true
Replace the city name in the URL. In the query result, woeid is the code.
You can log on to http://developer.yahoo.com/yql/lele/to query Geo. Places. Yahoo database can also find other interesting things.
Woeid obtained through latitude and longitude (not verified)
Http://query.yahooapis.com/v1/public/yql? Q = select *
From Flickr. Places where Lon = % F and lat = % F and accuracy = 6 (not verified)
Http://query.yahooapis.com/v1/public/yql? Q = select *
From Geo. Places where Lon = % F and lat = % F and accuracy = 6 (not verified)
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------
Finally, we will introduce the APIs of the Central Meteorological Observatory:
Obtain city weather conditions based on the following interface
Http://www.weather.com.cn/data/sk/101010100.html
Http://www.weather.com.cn/data/cityinfo/101010100.html
Http://m.weather.com.cn/data/101010100.html
JSON data is returned. The data returned from the preceding three URLs is different. Try it by yourself. The data is very full. 101010100 is the city code of Beijing, so the city code is still needed. Provide an incomplete urban code. I have been searching for it for a long time. There are about 20 provinces. The region can be specific to the county seat. Comprehensive apihttp: // dl.vmall.com/c0diylrr6a shared by the Central Meteorological Observatory city code (incomplete) rayyu1989
Central Meteorological Station city code: http://blog.csdn.net/ztp800201/article/details/10169863
Advantage: detailed information. I like this data very much.
Disadvantage: incomplete city code .... If anyone has full city code, please give me a copy.
PS: If you want to view the weather data format or specific type. You can directly copy the link to the browser to view the data.