September 9th, 2009


open source wednesdays

The Christchurch Creative Space is "a space in Christchurch, New Zealand for people to hack, craft, make, create and work on projects". It's a growing community of techy and creative types who meet twice a week, and has been ongoing for about six months now. It's formed in the spirit of the growing number of hacker spaces around the world.

I've been mostly showing up on Wednesdays, and I work on various software projects (usually). Since it's a creative space, I feel motivated to work on open source stuff. So with that in mind, I'm going to try to start "Open Source Wednesdays". Here's the deal: If it's Wednesday, and I'm working on something open source, I'll blog about it. I need to write more about the projects I'm working on, otherwise they'll just be a project for me, and what's the fun in that?

The first instalment will be posted later this evening.

open source wednesday: xearth

Years ago, I ported the classic Unix program "xearth" to Windows. Xearth displays an image of the Earth, as seen from your favorite vantage point in space, correctly shaded for the current position of the Sun. At the time, xearth had its own homepage and was updated every few years by the original author (Kirk Johnson). But a few years ago, I noticed that the original xearth home page had vanished from the internet. I was able to piece it back together using

I have resurrected the original xearth page at Currently this is the original (non-Windows) xearth page but I intend to pick up development of xearth going forward. I have created a Github repository containing all the past versions of xearth that I could find, plus my new developments.

One of the things that I've always wanted to add to xearth is the ability to "wrap" an arbitrary image around the Earth. There are loads of images suitable for projection onto a sphere, images of the Earth of all kinds. Here is the original xearth green-and-blue image (click for a larger view):

I finally (a decade later) got around to working out all the spherical trigonometry necessary to project images onto the xearth image. Here's a sample of what xearth can do now:

The maps don't even have to accurately reflect reality. Here is one from a 1678 world map:

Before I could do this with xearth, I also had to add the ability to create JPEG images (I added PNG while I was at it), and refactor some of the internal code to deal with true colour images instead of just palette-based images.

The code to do this is in the xearth repository on Github now. It's not ready for release yet, but feel free to fork and play with it.