Google Maps & hurricane data
08 July 2005 @ early morning | Comments (21)
Without further ado, Google Hurricane Maps
With a little help from Google Maps API, historical hurricane data from Unisys, JavaScript, and some PHP, I’ve managed to scrap together a fairly nice (albeit still a bit slow) hurricane tracking overlay displayed using Google Maps.
Currently, I’ll not bother releasing the PHP source because, quite honestly, it’s a tad ugly. This is partly due to the fact that I’d like to work on moving toward reformatting the data in XML, but primarily because the data formatting and standards used by Unisys really suck. For instance, they delimit values with a varying amount of whitespace, their dates follow no standard formatting that I know of, and it’s a little difficult to grab the most recent observed value (as opposed to projected).
It would be nice if you could do multiple colors on one polyline in Google Maps, but (afaik) this is still not possible. This would lead to a more intuitive display of the progression of each hurricane’s severity. As of now, the path color represents the current intensity of the storm; the hurricane symbol its location; and any path past the hurricane’s current position, its projected path. Perhaps I’ll look into breaking out the method so that each polyline consists of many small polylines, although I’m not sure of how successful I’d be with that. We’ll see…
Update: Now accepts querystring parameter for past storm data maps ranging from 1851-present.
July 9, 2005: Updated the icon for the hurricane (now it’s visible). Today I’m going to try and tackle multi-colored hurricane paths, although it may slow performance significantly due to the sheer quantity of polylines it’ll be stuffing onto one map.
July 10, 2005: Major updates. Hurricane intensity is now detailed in multiple colors, making for a much better visual representation of storm paths. It’s also now possible to view any storm’s data for any point on a path. Historical data is available back to 1851.
Thanks to stumbling across Unisys’ decade data files, I was able to mirror their data locally and reformat each year into a separate xml document. Initially this was to facilitate using XMLHttpRequest, but after seeing no advantage and more http transactions I decided to just access the data locally via PHP. So instead, SimpleXML makes it just about as easy to manage the data.
Anyways… I hope it doesn’t crash too many people’s browsers out there. For years that experienced above average hurricane activity, it can take quite a while to load and render all the hurricane data points and paths (sometimes up to 30 seconds). But eventually it’ll load, I promise. Maybe some JavaScript gurus out there see some major flaws in this; I’m open for suggestions.
July 10, 2005: Some minor updates. I added a marker denoting a hurricane’s last observed (or current) position. Additionally, the date of each observation is now included in each popup info window.
July 10, 2005: Greatly increased the size of the map… how big is too big?
July 11, 2005: Anyone know what’s causing it to fail in IE? I was getting the dreaded “Operation Aborted“ IE bug (probably relating to Google Maps modifying the DOM before the page fully rendered) so I wrapped everything with Simon Willison’s addLoadEvent, which seems to have fixed that bug but there still appears to be some other javascript error. IE’s javascript console is so incredibly shitty: all I get is “Object doesn’t support this property or method; Line 285; Char 3“.
July 11, 2005: Now uses a liquid width, to accommodate multiple screen resolutions. Also added the ability to show/hide the legend so that it’s much more easily-accessible.
July 11, 2005 Now working in IE (man, I really hate that browser).
July 13, 2005: Stepped down resolution of hurricane paths by 1/3, due to insane rendering times on years like 1995; I’ll likely add this as a customizable feature. I’m also testing local XMLHttp to see if there’s any effect, but so far it seems all the lag is simply due to rendering.
July 13, 2005: Now liquid(ish). Tested only so far in Firefox 1.0.4 & Safari 2.0.
July 17, 2005: Slightly increased the size of markers to allow for textual abbreviations of storm status (uses Kottke’s Silkscreen font). I hope to have individual storm paths working by next weekend, so that a full-resolution storm path is again possible.
July 23, 2005: Individual storm information is now available for each year (in full resolution, too!). All-storm view for each year will be kept at 1/3 data resolution to keep from wreaking havoc on slower computers for active years.
July 25, 2005: Now with current and past storm information for the Eastern Pacific (dating back to 1949), as well as this year’s data for the Western Pacific. I’ll see if I can’t scrape the remaining data and reformat in XML sometime soon.
July 25, 2005: Hm… crashing occurs when resizing in IE. Once again, Internet Explorer sucks. Working to fix. Fixed it by moving the onresize jiggery-pokery to precede the DOM manipulation, but still needs a little IE-tweakage.
July 31, 2005: Finished scraping & formatting the Western Pacific past storm data for the years 1945-2004. I never realized how much more active that region is than the Atlantic; it’s really incredible. To try and accommodate the massive amount of total yearly data, I’ve set the data resolution to 1/4 when viewing all storms.
August 18, 2005: Google Maps has updated their marker-rendering JavaScript, so maps should now perform significantly better than a month or two ago (up to 3 or 4 times faster rendering times!). I’ve also finished the migration of all XML data to a MySQL database so hopefully I’ll be able to perform queries against that data in interesting ways. I’ll work to preserve old urls’ integrity through this process.
August 27, 2005: Slight enhancement to projected path markers. Now includes visual indication as to projected storm intensity.
September 30, 2005: Complete overhaul of map… check it out.
21 comments