.Net API/Library for Weather Channel Forecast

16 Comments

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: , , ,

16 Responses to “API/Library for Weather Channel Forecast”

  1. Pedro Flores Says:

    Can’t you do one version that uses their locale code like UKXX0074? For someone that is outside the States cannot use this :\.

  2. Ryan Alford Says:

    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.

  3. Pedro Flores Says:

    Hmm, i cannot use any kind of locale, it gives error each time I try. But with Zip Codes it works wonderfully :D . But I would like it to work with locales also :\.

  4. Ryan Alford Says:

    Currently, this API only works with zip codes. I am working on adding locales.

  5. Pedro Flores Says:

    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.

  6. Ryan Alford Says:

    @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.

  7. Pedro Flores Says:

    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.

  8. Ryan Alford Says:

    @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.

  9. Ryan Alford Says:

    @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.

  10. Pedro Flores Says:

    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.

  11. Pedro Flores Says:

    Forget it, it now works again :D

    But I noticed that, for at least some main Portugal cities, like POXX0074(Santarem) the HI and LOW temperatures can be obtained.

  12. Caleb Green Says:

    I always like Sunny weather and disliked gloomy rainy weather.*`~

  13. Lucas Parker Says:

    the weather these days is hotter than the previous decades, i guess it is the effect of global warming,.`

  14. Sweetie Bracelet %0B Says:

    .;’ I am very thankful to this topic because it really gives great information ~.`

  15. Boog Says:

    Real brain power on dsilayp. Thanks for that answer!

  16. place Says:

    satisfying as well as concerned

Leave a Reply