{ Hi! I'm Mike }
I'm a core developer with The Horde Project and a founding parter of Horde LLC - the company behind the world's most flexible groupware platform. This is my personal blog full of random thoughts about development and life in general.
December 22, 2011

Service_Weather

With the recent discontinuation of The Weather Channel's public API access, Horde was left without a data feed for weather information other than the aviation style METAR/TAF reports. Weather information has historically been used  in two places in Horde; The WeatherDotCom portal block, and in the Timeobjects module, where we export the weather information to other applications - like Kronolith, Horde's calendaring application.

After an audit of available (and free) weather services, I settled on the following three services as suitable as alternatives to TWC's dead data feed.

Weather Underground: Of the three providers we decided to support, this one provides the most detailed data. You must sign up for an account for your Horde install. There is a free "developer" account option, though it does have relatively low usage limits which may be a problem if you have a large user base. We of course cache every request to help with getting the most out of those limits. They also offer very reasonable paid options as well.

World Weather Online: Another free service that provides a fair amount of data, though it's not as detailed as Weather Underground. Free account required, with higher limits than Weather Underground.

Google: Google does not provide an official weather API, but they do have an API interface that is used internally for Google's weather portal block. The data provided is not very detailed, but if you are looking for a provider that does not require any registration, this might be a solution for you.  No registration, no known limits, though this is unofficial, so keep that in mind.

It's worth noting that the biggest thing missing, even from Weather Underground's feed is the day/night forecast style. They provide an hourly forecast, but no simple day/night forecast. The non-hourly forecast data is provided as a single set of conditions for the entire day. Another fairly well known provider AccuWeather, appears to provide this (and fairly detailed data as well), but sadly, they have informed me that they no longer provide free data feeds - even for FOSS projects. Also, before anyone asks, yes I did look at Yahoo's weather feed. This is an RSS feed, which in and of itself is not a problem, but they only provided very basic data, for only a day or two in the future...not enough for our needs.

The end result of all this is the new Horde_Service_Weather library, a new Weather block, and support for the new weather drivers in the Timeobjects application for exporting the weather to applications like Kronolith.  As a side effect of all this, the weather support in Horde has, IMO, been greatly improved. The weather portal block code received a much needed overhaul including the ability to dynamically change the location being displayed directly from the portal screen, along with autocompletion of the locations.

At the time of this writing, Service_Weather is in Beta, and available via Horde's PEAR server. The new weather block is included in the most recent Horde release, and the latest Timeobjects release contains support for the new code as well.

For developers interested in learning how to use Service_Weather in their own applications - look forward to a blog entry in the near future detailing the usage.