Sorting out the National Weather Service XML feed

Tuesday, June 3, 2008, 12:19 PM
Website Design by John

I was tinkering yesterday with building a 7-day forecast from the data that can be had off the National Weather Service XML feeds. Let me tell you this: those feeds are frakkin cumbersome. Wow.

First off, the NWS feed is built to work with their own code using PHP/SOAP. Which, hey, I have nothing against, but not if that is all the feed is built to do.

The NWS is typical of what is wrong with a lot of government open data projects. Now, it isn't as poorly designed as the FCC's database -- because that was built to just be a pain, because you have to POST your request in before you can get the data. On the other hand, once you get the data out, the FCC's system is dead easy, since you can pull it all into an XLS or CSV format and from there do whatever you need to export it to database.

Advertisements


The NWS data is not only inconsistent, the keying on it is inconsistent. Hahaha.

Check it out, here:

Depending on how many hours of data the NWS has, the keys for the data change. But, it doesn't note which pieces of data the keys actually go to. So, for example, there maybe 57 pieces of data for the Dew Point that day, and it will correspond to one of the k-Xh-Xn keys. But, it only matches the keys to hours and and days in SQL format + GMT deviation.

So, you actually have to demuck from the feed how long the strings are for the data you want before you can match them to a key and thereby to a day.

For example, in order to pull the hourly predicted temperature, you have to find the XML category for that, identify it, load all its data into an array, and then count them. You also have to load all the keys for all the data. And you have to put them in an array and count those, too. And then you have to create your key-to-data matches by matching the counts against the key of the same length.

I don't have a problem with doing that. But, holy shit is that a lot of effort to get at what is supposed to be easily publicly available data!!

Some point here I will clean up the code and post it here. If someone has a strong interest in it,
use the contact page and I will post it.


Mail article to a friend

© 2008 Pro Content and Design. All rights reserved.


Tools

Check Google PageRank


Recent articles

  1. Friggin objects nested in PHP arrays
  2. PageRank from a single link over many high PR sites
  3. PlayStation 3 browser pops up in logs
  4. eBay will be the first big, successful Web 1.0 company to die
  5. It's awesome when your joke takes off
  6. Domain name generator, plus WHOIS and PageRank features
  7. What I've been working on lately
  8. Even my spam tells Soviet Russia jokes
  9. Did a similar text function bite Yahoo in the ass?
  10. Copyright bullies

Welcome!

Wonder where to start with your web design business?

This blog follows along with my efforts to build and grow a website design business, Pro Content and Design.

The goal of this blog is to fill in blanks that may be empty as you get your business rolling.

This blog, particularly the source code section, is not intended for beginners. If you are not comfortable with databases, Ajax, DOM objects and other advanced methods, I strongly suggest you go take a look over at W3 Schools before even reading -- let alone tinkering with -- any of the code here.

I hope this blog has some value to web designers as they attempt to get their businesses going.

Good luck, and happy reading.

Thank you,
John Crawford
Pro Content and Design

Books


I highly recommend Art of the Start if you have no idea where to start with marketing.

Links

Coding
W3 Schools
IBM's Mastering Ajax Series

Graphic Design
Worth 1000
Stock.XCHNG
Urban Fonts

Website Software
Apache Web Server
SquirrelMail
PHP/Zend

Website Design Issues
Non-Standard Character Guide
Google Trends
Search Engine Optimization Analyzer

Business
Guy Kawasaki's Blog
Seth Godin's Blog
Freakonomics

Computers
NewEgg

My Main Website
Pro Content and Design

Websites I have built
PunxsyPage: local free classifieds website

Farm N Land: low-cost real estate listing website

InvestYoung: semi-defunct finance blog

Groundhog Festival: for the local summer festival

Weather Discovery Center

My Webapps
TV Stations Transmitter Database

Google PageRank Checker

Website where I did the code, database and admin
Tour de Toona: annual bicycle race in Altoona, PA