.Net → API/Library for Weather Channel Forecast
I was bored so I decided to create a API/library for the Weather Channel’s weather forecast webservice. This library will parse the XML returned from the webservice and return it back in custom classes that are easier to deal with. This will return the current conditions and the 5 day forecast for a specified zip code.
This API supports US zip codes and international “locale” codes.
You will need to signup for your own PartnerID and LicenseKey with the Weather Channel(it’s free). That can be done here. You should also download the Weather Channel SDK so you can get the weather images. I return a “icon code” which will tell you which image to use.
I have put the code on CodePlex. It will contain both the .dll file, and the source code. I felt it was easier to keep up with using CodePlex.
Tags: API, C#, library, Weather Channel
December 26th, 2009 at 3:00 PM
Can’t you do one version that uses their locale code like UKXX0074? For someone that is outside the States cannot use this :\.
December 28th, 2009 at 9:44 AM
I did a quick search of the documentation, that there isn’t much on using the locale for outside of the US. I will do more research.
January 10th, 2010 at 8:54 AM
Hmm, i cannot use any kind of locale, it gives error each time I try. But with Zip Codes it works wonderfully
. But I would like it to work with locales also :\.
January 11th, 2010 at 10:20 AM
Currently, this API only works with zip codes. I am working on adding locales.
January 31st, 2010 at 5:27 AM
So, have you made any progresses on it? I have tried one time the XOAP ling and putting the locale on behalf of the zip code returned data.
February 1st, 2010 at 11:19 AM
@Pedro Flores
I have not made any progress. I searched the documentation of The Weather Channel’s service that I am using, and it has nothing about setting the locale. It’s always set to “en_US”, and I can’t find a way to change that.
I have also looked for other free weather services for Europe, and I have found nothing.
If anybody knows of a weather service that provides free access to their weather data for Europe like The Weather Channel does for the US, or any information on how to use the locale setting with The Weather Channel’s feed, then I am open to hear it. I will be happy to update my API to use the locale, but I can’t find anything to tell me how to do it.
February 2nd, 2010 at 6:08 AM
No, that wasn’t what I was trying to tell you. On your dll, on the GetWeather() method, it accepts only zipcodes, I cannot put any string larger than 5 numbers, so for example UKXX0075 is out of the question.
But if I take UKXX0075 and put it instead of the zip code on the XOAP, it returns data anyway. So it probably handles other codes as well.
February 3rd, 2010 at 2:04 PM
@Pedro Flores
ahh…I see what you mean. The problem is really the data that comes back. My dll doesn’t limit it to just zip codes, it will accept any string. The problem is the data that is returned. It seems for non-zip codes, the service returns “N/A” for a number of the values(for example, the “hi” temperature is “N/A” for UKXX0075). Since it didn’t do this for the US zip codes, I have zero checking for bad values. So I am trying to convert the “N/A” to a numeric value, which is failing.
I will make changes to add more exception handling.
February 3rd, 2010 at 3:12 PM
@Pedro Flores
I have uploaded a new release to CodePlex. This will now allow for the use of the locale codes instead of zip codes.
February 8th, 2010 at 5:15 AM
Well it’s has been working great, but today it stopped working:
[CODE]
Dim os As New WeatherCenterEclipse.WeatherReport
Erratic Line ->os.GetWeather(My.Settings.localizacaoGuardada, My.Settings.partnerID, My.Settings.licenseKey)
[/CODE]
It now gives (on the DLL) NullReferenceException.
I’m not understanding this since yesterday it worked great and today it doesn’t work at all.
February 8th, 2010 at 5:18 AM
Forget it, it now works again
But I noticed that, for at least some main Portugal cities, like POXX0074(Santarem) the HI and LOW temperatures can be obtained.
May 24th, 2010 at 2:20 AM
I always like Sunny weather and disliked gloomy rainy weather.*`~
August 2nd, 2010 at 11:32 AM
the weather these days is hotter than the previous decades, i guess it is the effect of global warming,.`
January 24th, 2011 at 12:33 PM
.;’ I am very thankful to this topic because it really gives great information ~.`
April 12th, 2011 at 9:15 AM
Real brain power on dsilayp. Thanks for that answer!
November 22nd, 2011 at 10:15 PM
satisfying as well as concerned