Display Local Weather Data On Your Site
page 3 of 7
by Andrew Mooney
Average Rating: 
Views (Total / Last 10 Days): 42606/ 65

Current Weather Conditions XML Feeds

XML is a great choice for distributing data. That is probably why the National Weather Service (NWS) has chosen XML as the format to distribute their current weather conditions for about 1,800 locations in the United States. These feeds are updated hourly and come in both XML and RSS formats. The focus of this article will be using the XML feeds to display current local weather conditions on your web site.

The first step is to go to the NWS web site using this link. Once you are at the NWS site, to find your local weather station just select a state and then select the orange and white XML image next to the location that you want to display in the XML column. There are two columns of XML images; the first column contains a link to the RSS file, the second column links to the XML file and that is the one you want. What you are looking for is the four character station ID. In my example I will be using the station ID for Chicago's Midway Airport which is KMDW. Once you click on the link, the XML feed will be displayed in your browser. It will look similar to Listing 1 for Midway Airport. The URL for the XML feed you have chosen will be in your web browser's address bar. You will need to write down or copy and paste this URL so that we can use it when building our web page.

Listing 1 shows a snapshot of an actual XML feed for Chicago's Midway Airport. This snapshot was taken from this URL. The URL you saved should look identical except for the four character station ID. Taking a look at the different nodes in the listing will give you an idea of what current weather conditions can be displayed.

Listing 1 - This is a copy of the XML feed for Chicago's Midway Airport

<?xml version="1.0" encoding="ISO-8859-1" ?>
<current_observation version="1.0" 
<credit>NOAA's National Weather Service</credit> 
<title>NOAA's National Weather Service</title> 
<suggested_pickup>15 minutes after the hour</suggested_pickup> 
<location>Chicago Midway Airport, IL</location> 
<observation_time>Last Updated on Jan 5, 7:51 pm CST</observation_time> 
<observation_time_rfc822>Fri, 5 Jan 2007 19:51:00 -0600 CST
<temperature_string>50 F (10 C)</temperature_string> 
<wind_string>From the North at 6 MPH</wind_string> 
<pressure_string>29.67" (1005.0 mb)</pressure_string> 
<dewpoint_string>42 F (6 C)</dewpoint_string> 
<windchill_string>48 F (9 C)</windchill_string> 

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-05-24 8:50:40 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search