This article is about a small non-MFC Win32 application that uses Yahoo! Weather RSS feeds to parse and show the weather information to the user. These RSS 2.0 feeds are represented by a small XML file with a very simple inner structure which makes it easy to the 3rd party applications to parse and show weather information all around the world and at any time. You can find more info about developing the custom application which uses these feeds on the following web site: Yahoo! developer's corner.
Using the Code (Application)
To use the application just open the compiled Yahoo Weather Viewer.exe file in the Debug or in the Release folder of the project directory. One will also find the Countries folder which holds data about different countries (for easier access). I have built these data files using Yahoo! Weather web site for most European countries. They are plain text files so one will have no difficulties to understand them.
The application sends a simple
HTTP GET request to the Yahoo! Weather service. It has the following form:
p here stands for location ID or a ZIP code (US only). The second parameter
u stands for units (Celsius or Fahrenheit degrees, miles or kilometers, etc). The returned file has a simple RSS 2.0 structure shown below:
- ...weather info...
- ...weather info...
So, this web service response needs to be parsed and weather information has to be extracted. This feed covers information considering the following:
- Location info (city, region and country)
- Units info (temperature, distance, pressure and speed)
- Wind info (chill, direction and speed)
- Atmosphere info (humidity, visibility and pressure)
- Astronomy info (sunrise and sunset)
- Conditions info (description, temperature and date)
- Forecast info (day, lowest temperature, highest temperature, description and date)
On the other hand, to obtain the satellite or any other kind of map with weather conditions, one will have to look for it on the special image locations (Yahoo! Weather service periodically updates these images). See links below for examples:
After downloading, these JPEG files can be converted and shown to the user.
Points of Interest
I had a very good time building this application and I hope people will find it useful.
- August, 2007 - Yahoo! Weather Viewer v1.0