Andre's Blog

Personal blog of Andre Perusse

Weather RADAR for Canada - a Yahoo Widget

I seem to be obsessed with the weather lately. So are a lot of other people judging from the amount of weather-related widgets and "parts" for public portals. One of my favourites was a Yahoo widget that showed the precipitation RADAR imagery from Environment Canada's web site. Unfortunately, the widget stopped working last year when Environment Canada changed how the web site worked.

So, I took a look at the Yahoo Widget SDK and it seemed like an easy-enough technology to develop with. The main widget file is an XML document that allows you to lay out window areas with text blocks and images. It also allows for the description of timer events and preference settings. The programmatic aspect of the widget is controlled with simple javascript, though as I learned the hard way, it's not really the same as using javascript in a web page. For example, there is no Image() object in a Yahoo widget. The Image() object is not an intrinsic javascript construct - it is actually part of the browser's HTML document object model. So don't try pre-loading any web graphics the good old fashioned way.

Still, once you get the hang of it, developing a widget is pretty straight-forward. I'm not really a fan of the absolute positioning required for text blocks, but the technology is simple to understand. I was able to develop most of the Weather RADAR widget in a weekend. Not that this widget is particularly complex, but it's not totally simple either.

Some of my favourite features of this widget are:
  • It automatically refreshes with the latest RADAR image every 10 minutes. This is how often Environment Canada updates the image on their web site.
  • Similar to the actual web site, the user can select which "overlay" images to display on top of the RADAR image. The overlays consist of markers for cities, roads, rivers and more.
  • Double-clicking on the RADAR image will toggle the animation of the image.
  • The image can be resized from 25% to 175% of the original image size.
If you're interested, you can download this widget from my Duotronic site:

Comments (3) -

  • Darth Mac

    1/26/2007 11:05:15 PM |

    This will come in handy when Ball season cranks up again!

  • Chris MacDonald

    2/9/2007 8:02:45 AM |

    Very nice (as Borat would say)!  Can you work on creating a widget that will predict the weather?

  • m00se

    2/9/2007 4:49:00 PM |

    Excellent  !!  I"ll be using this all the time  ,  be nice if you wrote something like Yahoo Weather (but that would get it's data from enviorment canada) as a companion or add on to the weather map !!

    Again Thank you very much