Map of Australia mapped on Australia |
You see, yesterday evening I decided to finally take a closer look at the D3 visualization library. A couple of the demos on the d3js page, notably the excellent animated show reel and some of the mapping examples, made me think of discussions I have had with colleagues and friends on map projections. I wondered if animating the transition from one projection to another would help show the problems with certain (overused) projections (like the omnipresent Mercator (we are no longer colonialist seafarers, now, are we?)).
I created a quick hack, based on some example code from the d3.geo-library, added some simple selection box controls, and transition animations, and voilà: http://bl.ocks.org/4742558 - an interactive animated map projection demonstration tool. Try switching between Mercator and some (more) area preserving projection (like a cylindrical one) and you'll catch my drift. (Word of warning: some projections tend to crash the browser - probably because of my naïve implementation of swapping between them. (I'll try to take out the misbehaving ones - or at least flag them.))
The source code behind this is displayed prominently below the map if you follow the link above. (Another word of warning: JavaScript is not exactly my mother tongue.) (Al)so, there are several weird features that I've been to lazy to take care of...
I revisited this hack today, though, and made it look neater (with blue water - that is for you, Seb) - and the code is (maybe) cleaner, but morphing between projections looks more messy - probably due to my limited understanding of both JavaScript and D3: http://bl.ocks.org/4739921
Bottom line is: I'm really excited about the potential of the D3 library! Thanks Michael Bostock!
(And I do of course realize that not all of these D3 projections were made for world maps...)
Update: I guess I should go through the projections one by one and set the correct scale, so the maps keep their general size better. Also, it could be interesting to pan in a more reasonable manner. (Especially the orto-projections.)