Sunday, April 26, 2009

H1N1 Swine Flu TimeMap

Tweets from @ attilacsordas and @stew alerted me to the Google Map of the H1N1 Swine Flu outbreak by niman.

Ryan Schenk commented: "It'd be a million times more useful if that map was hooked into a timeline so you could see the spread.", which inspired me to knock together a timemap of swine flu. The timemap takes the RSS feed from niman's map and generates a timemap using Nick Rabinowitz's Timemap library.



Gotcha
Although in principle this should have been a trivial exercise (cutting and pasting into existing examples), it wasn't quite so straightforward. The Google Maps RSS feed is a GeoRSS feed, but initially I couldn't get Timemap to accept it. The contents of the <georss:point> tag in the Google Maps feed looks like this:

<georss:point>
33.041477 -116.894531
</georss:point>

Turns out there's a minor bug in the file timemap.js, which I fixed by adding coords= TimeMap.trim(coords); before line 1369. The contents of the <georss:point> taginclude leading white space, and because timemap.js splits the latitude and longitude using whitespace, Google's feed breaks the code.

Postscript
Nick Rabinowitz has fixed this bug.

6 comments:

Nick said...

Fixed in trunk :). Great timemap - glad you found the library useful!

Steve said...

How are you getting the original data? Is it generated by Google? There are problems with it. One data point (Philadelphia, today: "sick person taken off plane at PHL") links to a story that states she tested negative for swine flu:
http://abclocal.go.com/wpvi/story?section=news/local&id=6783337

Roderic Page said...

I'm using the RSS feed from the source Google Map, so it's really a question for the people assembling that feed.

Rob Beiko said...

That's a very cool application, but it looks like the free Google Maps mashup has moved to the FluTracker site (http://flutracker.rhizalabs.com/) - are you still able to access the data?

Roderic Page said...

Rob,

Actually I switched early on to a different source (also available via http://swinemap.org/ to get a map with fewer duplicates and links to the source stories.

Henry Niman's original map has, as you noted, moved to the much slicker http://flutracker.rhizalabs.com/, which provides a RSS feed (and other download options).

Rob Beiko said...

Ah, that's excellent, thanks! We're about to start tracking the evolution and spread of H1N1 using GenGIS (http://kiwi.cs.dal.ca/GenGIS), and I have been combing the news trying to fill in incomplete collection locations and dates. This will be a huge help.