Fun With Polymaps

Recently I had a few ideas I wanted to try out in geographical data visualization. I’ve never really done any data vis stuff, other than a few charts here and there, so I had no clue where to even begin.

At Wotif, I’ve been heavily involved in the Reviews system, which went live a couple of months ago. What I wanted to do was color a world map to signify the density of Reviews for hotels in each country. After some pathetic Google-fu, I ran into the Geochart visualization from Google Chart Tools. The Geochart visualization was a good start, but I quickly discovered just how limited it was when it comes to client-side interaction. I was sure there must be something more, but having never had much to do with mapping on the interwebz, I could not even begin to figure out the question I needed to ask, let alone the answer.

Thankfully, I discovered that what I was trying to display was a Choropleth Map. Once I knew this, it didn’t take long before I stumbled upon this fantastic blog post from someone trying to do exactly the same thing as I. It was through this article that I had my eyes opened to a whole world of amazing mapping tools and libraries. The one that struck me as the most interesting was none other than Polymaps, primarily because of the way it leveraged SVG for some pretty sexy looking “slippy” maps.

Even once I’d gotten my foothold in this wealth of information, I was still pretty lost. Answering my initial question lead to a myriad more. What is GeoJSON? How do tiles work? Where does a Tile Cache come into play in all this? Wading through the mass amounts of information was pretty daunting.

In the end I focussed back in on what I was trying to do. I wanted a simplistic world map that I could mutate and accept user input on. Poring over the Polymaps examples, I determined that GeoJSON would help me render an world map with country outlines. A bit more Googling and I found a fantastic Github repo - johan/world.geo.json, with all countries in a GeoJSON file.

Armed with this GeoJSON file, I was easily able to fumble about and mash my face against the keyboard until I got the desired result, a nice Choropleth map that users could mouseover to see more information! I bundled this up in a nice little dashboard with some other statistics I cooked up. I’ve since shown it to a few people at Wotif and they seem to like it.

The initial experiment only whetted my appetite though, and I’m finding myself quite engrossed in the world of amateur cartography. I’ve since started cooking up some interesting real-time displays using Polymaps, overlaying SVG drawing onto the map and doing some fun stuff with it, like smooth panning/zooming between points and extents. I will blog more about some of the cool stuff I’ve come up with.

Bye internets!

Comments