Archive for November, 2007

Weather and Widgets

I’ve recently done a bit of noodling with widgets. As a first test, I wrote the canonical/ubiquitous weather widget. If you’re interested in how to write a basic Konfabulator widget, check this out (all the standard disclaimers about code quality, comments, error handling, general programming aesthetics apply…).

To test the widget just unzip it, navigate to the .kon file in the basicweather/Contents sub folder and open it with the Yahoo! Widgets application (a.k.a, Konfabulator).

Even if you’re not interested in the widget bits, you might be interested in the site the example uses, geonames.org. They provide a REST webservice for retrieving place information. I used the following two services in my sample:

The first retrieves lat/lon for a postal code. The second one uses the lat/lon to get the most recent METAR (weather observation) nearest that lat/lon.

It’s a really practical information source and having the REST/JSON interface is nice.