Google’s Secret Weather API

Adam DuVander, February 8th, 2010

Google HomepageIt’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.

42 Responses to “Google’s Secret Weather API”

February 11th, 2010
at 1:14 pm
Comment by: Ted DRAKE

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.

February 12th, 2010
at 12:06 pm
Comment by: YT

hl=ISO 639-1 Language Code

For example, to get the weather for Paris, France in French, one would use the following URL:
http://www.google.com/ig/api?weather=paris,france&hl=fr

February 14th, 2010
at 4:52 am
Comment by: MikeKear

Where does the weather information come from? Is it the official government weather bureau? The Weather channel?

February 17th, 2010
at 8:18 pm
Comment by: MikeKear

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.

March 4th, 2010
at 11:05 am
Comment by: 2010/03/04に気になったこと | debeso

[...] Google’s Secret Weather API GoogleのSecretAPIが便利そう 天気API 株価API ニュースAPI [...]

March 12th, 2010
at 12:25 pm
Comment by: Francesc Rosàs

@MikeKear it seems Google gets the data from Weather Underground http://stackoverflow.com/questions/507441/best-weather-apis

April 14th, 2010
at 11:38 am
Comment by: Dan

We have been using http://www.worldweatheronline.com/weather-api.aspx . It’s free and seems to be really good and has a forum too.

September 8th, 2010
at 3:03 am
Comment by: Shedman

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.

September 24th, 2010
at 4:07 am
Comment by: Arduino vejr station | Denus Labs

[...] dataerne er hentes fra google’s “secret weather service“, som jeg i øvrigt heller ikke har kunnet finde nogen dokumentation på fra googles side af, [...]

September 25th, 2010
at 3:59 pm
Comment by: Vorstalarm « ideaton

[...] Google’s secret weather API: [...]

September 28th, 2010
at 12:16 pm
Comment by: Jan-Piet Mens » Performing dynamic DNS updates on your DNS

[...] 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.) [...]

October 20th, 2010
at 5:39 am
Comment by: 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.

October 28th, 2010
at 2:31 pm
Comment by: Mike

I implemented this weather function on eXorithm. You can see the source code (and run it) at:
http://www.exorithm.com/algorithm/view/weather_forecast

December 3rd, 2010
at 8:54 am
Comment by: bob

Any know if this would take long and lat points and give you the forecast according to them?

December 3rd, 2010
at 9:18 am
Comment by: Adam DuVander

I don’t think so, Bob. Since it’s undocumented, it’s hard to say for sure. However, you could use a reverse geocoder to determine the city from lat/long. Then pass the city name to the Google Weather API.

See a list of geocoders here:
http://www.programmableweb.com/apitag/geocoding

December 22nd, 2010
at 12:13 am
Comment by: sh mad dog

Windspeed on homepage is very different from weather page

December 23rd, 2010
at 11:51 am
Comment by: Henrique Hohmann

Hi Adam,

I just finished a javascript library to get the data from Google. Check it out: http://blog.hohmann.nu/google-weather-library
Cheers!

January 12th, 2011
at 7:20 am
Comment by: Installing, Configuring and Deploying components to Jabberwocky « One Minute Distraction

[...] is a component that uses Google’s weather API to display the weather of a city as shown in the following [...]

February 8th, 2011
at 4:43 am
Comment by: This is how a Public Sector API should work « eGovernment TrendCreator | Daily thoughts by MFBorman

[...] 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. [...]

March 14th, 2011
at 8:06 am
Comment by: Bruce

I have found the weather data is totaly off base. The temp. forecasts for my city are out by 8-10 Degrees C. This api is useless.

March 18th, 2011
at 2:24 am
Comment by: 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

May 14th, 2011
at 8:36 pm
Comment by: #! » Weather or not

[...] 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). [...]

May 27th, 2011
at 3:51 am
Comment by: Tom Simpson

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.

May 27th, 2011
at 11:40 am
Comment by: Todd

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

May 28th, 2011
at 2:45 pm
Comment by: 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

June 6th, 2011
at 4:36 am
Comment by: Tom Simpson

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.

June 6th, 2011
at 12:37 pm
Comment by: 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

June 8th, 2011
at 3:19 pm
Comment by: furorum.de - nur ein weiterers einfach.so.blog » Archiv » Google Weather API – Auch hier gibt’s eine Blacklist

[...] Vorhersage per XML zurück. Die Funktionsweise und Nutzung ist im Netz ja inzwischen hinlänglich dokumentiert (oder auch [...]

June 19th, 2011
at 6:37 pm
Comment by: jfrez

I recently develop a weather page with geolocalitation (HTML5), try this api:

http://www.theweathernow.net/api/

it uses the google weather api.

July 21st, 2011
at 10:46 am
Comment by: JP Yao

iOS and Mac developers, you can use an API that I have created for Google’s weather service. It basically does all the parsing and stores everything in NSStrings, NSDates, NSURLs, and NSNumbers.

http://iphonecodesamples.wordpress.com/2011/07/21/an-iphone-api-for-accessing-googles-secret-weather-service/

September 2nd, 2011
at 5:18 pm
Comment by: Patch Labs » Something Silly

[...] as how we were experimenting with the google weather API we thought, “Why not combine [...]

September 12th, 2011
at 9:38 am
Comment by: Weather Underground Goes JSON-Only With New, Freemium API

[...] is one of 16 weather APIs in the index, which does not include Google’s Secret Weather API. Related ProgrammableWeb ResourcesLearn more Weather Underground (Wunderground) API [...]

October 5th, 2011
at 7:42 am
Comment by: Tutorial: Wygląd strony zmieniający się wraz z pogodą. | Artis Media

[...] 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 [...]

November 1st, 2011
at 9:06 am
Comment by: Niek

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 ‘

November 6th, 2011
at 2:23 pm
Comment by: weather plugin say Invalid license key - Page 2 - MediaPortal Forum

[...] weather plugin say Invalid license key What about Google Google’s Secret Weather API WeatherBug WeatherBug API Profile Accuweather AccuWeather API Profile Weather Central Weather [...]

November 21st, 2011
at 5:40 am
Comment by: Tom Simpson

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.

December 9th, 2011
at 5:00 pm
Comment by: Are there free high quality weather data web services available? [closed] | Software development support, software risk,bugs for bugs, risk analysis,

[...] (unofficial?) Google Weather API: Free but not sure if allowed to use on iOS. XML. Takes city name or ZIP code as input. Therefore requires multiple requests (Reverse Geocoding upfront). Therefore probably slow. (Tutorial) [...]

December 9th, 2011
at 9:01 pm
Comment by: Which weather data web services do you know?

[...] (unofficial?) Google Weather API: Free but not sure if allowed to use on iOS. XML. Takes city name or ZIP code as input. Therefore requires multiple requests (Reverse Geocoding upfront). Therefore probably slow. (Tutorial) [...]

December 21st, 2011
at 9:30 pm
Comment by: OpenSprinkler ‘Weather’ Feature coming soon « Rayshobby

[...] for the upcoming ‘weather’ feature in the OpenSprinkler software. It makes use of the Google Weather API to obtain current weather data in your local area. The Google Weather API returns data in XML [...]

January 6th, 2012
at 11:45 am
Comment by: 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/

February 3rd, 2012
at 12:17 pm
Comment by: Prognoza Vremena

Thank you Sebastian.

February 10th, 2012
at 11:50 am
Comment by: Google Trends API: Developers Want It, Says Google Insights

[...] we list 19 unofficial APIs. And the search giant is no stranger to the idea, since it maintains an unofficial, secret weather API. Related ProgrammableWeb ResourcesLearn more Google Translate API [...]

Leave a Reply

  1. (not published)

Mashery: The Premier API Management Solution

Become a ProgrammableWeb Sponsor

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.