Date: 2009-09-09 23:19:00
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 archive.org.

I have resurrected the original xearth page at xearth.org. 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.
[info]decibel45
2009-09-10T03:40:21Z
The logical extension of this would be to allow it to interface to a GIS source. I know there's some OSS GIS stuff out there; not sure how much of it can project onto a sphere (though it sounds like maybe you don't need that now).
[info]ghewgill
2009-09-10T10:00:30Z
Some of the maps above come from links on the Xplanet map collection page: http://xplanet.sourceforge.net/maps.php

Virtually all geo-related earth maps come in the same width-twice-the-height format, which xearth automatically knows how to deal with. Xearth can also display maps using mercator or cylindrical projections, the overlay map is projected as necessary:

Greg Hewgill <greg@hewgill.com>