Google's Secret Weather API

Adam DuVander
Feb. 08 2010, 03:43PM EST

It's 54 degrees today in Mountain View, which any Googler could tell you by looking outside... or by using the company's undocumented weather API. The service was created for use with iGoogle, but the interface is easily discoverable and covers a handful of other features, in addition to weather. Dennis Delimarsky compared several weather APIs and decided that Google's is best, despite having no documentation or support from the company. One reason Delimarsky found it useful is that Google left little work to the developer:

Unlike many others, the XML response for Google Weather API calls is quite explicit. No need to figure out what a specific abbreviation means or whatever a code means to a developer. There is either a positive response (with conditions) or a response notifying of an error.

Indeed, you just simply pass a city name or postal code, such as this Mountain View query:

http://www.google.com/ig/api?weather=Mountain+View

to get an XML response like this: googe_weather And the reason for the human-readable XML goes back to the original purpose of this API. The iGoogle dashboard simply consumes the feed and styles it for users. If the XML was complicated, so would be the weather on the iGoogle page. The API has been accessible for some time, but it's as unofficial as can be. Tom Fitzgerald provided some documentation and PHP source back in August. And almost two years ago someone asked about it on a Google message board, with Googler Jeff Fisher stating that it is "for gadget use only." There are a handful of official weather APIs. And, as we noted in our weather APIs post in April, there is a lot of developer interest. ProgrammableWeb lists 83 weather mashups, but only 8 weather APIs. For those willing to skirt the line and use Google's unofficial weather API, you're in for an additional treat. The iGoogle interface can also access Google's secret stock API and a strange abbreviated movies API, in addition to a news feed that goes beyond the top three items usually provided by the Google News RSS.

Adam DuVander Hi! I'm Developer Communications Director for SendGrid and former Executive Editor of ProgrammableWeb. I currently serve as a Contributing Editor. If you have API news, or are interested in writing for ProgrammableWeb, please contact editor@programmableweb.com Though I'm a fan of anything API-related, my particular interest is in mapping. I've published a how-to book, Map Scripting 101, to get anyone started making maps on websites. In a not-so-distant past life I wrote for Wired and Webmonkey.

Comments

Comments(68)

I was looking for something like this while building a YOS application. However, I couldn't find a weather API that output non-english text. Do you know what parameter would allow the user to switch languages? I tried lang=fr and intl=fr with no luck. The api still works, but it is in English.

Well after waiting 4 days for a response, none has been forthcoming. I know why.

Google has the wrong weather information.

The observations dont match the official government observations, and the forecasts dont either. They dont match the Weather Channel's either.

This means that Google's API might be easy to use, but the information it provides appears to be useless, since it's wrong. IF you put weather information on your web site and someone acts on that information, and it subsequently turns out to be disastrously wrong, you can end up with a liability. IN our case we're a radio station, and we carry the official weather forecasts on the air. We can't have different forecasts and observations on our web site.

It's a pity Google cant see fit to identify who's making up the information they're giving out, and give their information some credibility.

[...] What are we going to update the DNS with? As an example, I'm going to add a DNS resource record called city.temp.aa, with city being the name of the town I'd like to be in. The resource record will be a TXT record containing the current temperature. But where do I get that from? I'm going to use the Yahoo! Weather API to retrieve the current temperature of the location(s) I'm interested in. I could also use Google's not-very-well-documented (a.k.a. secret) weather API. (Read about that here.) [...]

sid

I think the criteria for choosing the "Best" API should not be how easy is it for the developer to implement but how accurate data it provides and how stable it is from the inside, so that a developer doesn't needs to update his code every time google update its own.

Is anyone aware of an api like this but to be used to search for information such as hottest or wettest place ? Thanks in advance for any help.

[...] This is how a Public Sector API should work Yesterday I blogged about why the Public Sector should shift their focus from websites to webservices and apps. In order to give all of you who are not developers an idea how such an API should work, have a look at the Google Weather API. [...]

bhaskar

Hi Guys..I am new to these APIs. Can you please help me selecting paid/free in the following to cover important cities all over the world:

a. Weather

b. Currency conversion

c. Distance between cities

d. Distance between Airport

e. Translator tool

Google recently changed their API, as far as the icon data, anyway. The API changed the location of the icons to a sub-directory at gstatic.com. Most apps (including the one I wrote) hard-coded the main URL and used forecast->icon['data'] to grab the current image.

Since the full URL of the icon location is in the API, now, simply removing the "http://google.com" from the code will restore working icons to the apps that they seem to have went missing on.

todd

Thank you Tom. I just noticed that my icons had disappeared, and was trying to figure out why. Your solution solved my issue!

man

I prefer the old icons, cause the new white background looks bad on non-white boxes, maybe if they were transparent. However the old icons are still there so i tryed to change the new url with the old one with regex but new names are different, like: partycludy instead of party_cloudy so I couldn't do that

[...] 16-04-2012 Google's weather api is an undocumented weather api for all major cities in the world (programmable web google's secret weather api). The api was specifically designed for creating apps (programmable web - google's web api [...]

Derrick

Hi Adam, and whoever else may read these comments.

I'm currently using the Google Weather API... if you'd like to see my site, it's at toyweather.herokuapp.com

It's just a novelty web app that loads images based on the xml data.

Anyway, in order to really customize the site, I'd need to know what the possible values are for the weather conditions...

I know the API is undocumented, but has anyone written down a list of what the "Conditions" can be? I've seen the regulars like Overcast, Cloudy, Clear, Light Rain... but am wondering what other possibilities there are.

Thanks!

man

Yes Tom, the old icons are back! I just hope that they are not going to change them again soon cause I'm getting tired of add and remove the base url! ahah

Well, man, it looks like they saw your comment about the old icons. They actually just changed everything back to the way it was, earlier this morning. Had to add the base URL back into the code to get it working again. No idea why it was changed to begin with, then changed back, though.

sebastian

HAMweather just released their own Aeris weather API recently that appears to be considerably better than many of the major ones out there like TWC and Google. It's not free, but provides more data and is a lot more flexible based on your needs. They also have a series of toolkits to integrate their API with custom applications built for the web or mobile (including iOS).

http://www.hamweather.com/products/aeris-api/

[...] I’ve tried a few solutions but all of them suck due to poor documentation (PHP Weather I’m looking at you), jingoistic support for only USA airports (PHPWeatherLib) or being otherwise perfect but too simplistic (Google Weather API). [...]

[...] serwisów pogodowych udostępnia swoje API, my początkowo wybraliśmy „sekretne” api google weather, jednak mimo dobrej dokumentacji jeszcze niedawno było całkiem mało stabilne i często nie [...]

I just noticed that Google went from the default 5-day forecast to a 4-day forecast. It changed within the past 24 hours, and I don't know if they'll bring the 5-day back.

Not sure what kids of display problems this may bring for others, but the vertical listing that I have, now has some extra space at the bottom. I'll have to fill it with something if they leave it this way.

You can ask the google weather for multiple places like below:

$xml = simplexml_load_file('http://www.google.com/ig/api?weather=Amsterdam&weather=Cambodja');

//$information = $xml->xpath("/xml_api_reply/weather/forecast_information");

$current = $xml->xpath("/xml_api_reply/weather/current_conditions");

echo '

icon['data'].'" alt="weather">

'.$current[0]->temp_c['data'].'° C

';

$city["Name"] = "Amsterdam";

$city["GMT"] = 1.0;

$city["actualDST"] = 0.0; //Because it's summer time

$gmt_diff = $city["GMT"]+$city["actualDST"]; //your functions for getting the hour difference betweer the city and the GMT

$city_time = time()+($gmt_diff*3600); //sum the timestamps

//echo ''.gmdate("",$city_time); //echo the formatted date

echo '  '.gmdate("H:i",$city_time).'    ';

echo '

icon['data'].'" alt="weather2">

'.$current[1]->temp_c['data'].'° C

';

$city["Name"] = "Phnom Penh";

$city["GMT"] = 7.0;

$city["actualDST"] = 0.0; //Because it's summer time

$gmt_diff = $city["GMT"]+$city["actualDST"]; //your functions for getting the hour difference betweer the city and the GMT

$city_time = time()+($gmt_diff*3600); //sum the timestamps

//echo ''.gmdate("",$city_time); //echo the formatted date

echo '  '.gmdate("H:i",$city_time).'    ';

echo '

[...] Google intern Joey Scarr had a busy first month at the search giant’s Sydney office, home of much of the Google Maps API engineering team. Scarr added the weather layer, available on the Google Maps website, as an optional layer in the API. The resulting feature even gets you at some of the data, making it close to an official Google Weather API. [...]