Greg Hewgill (ghewgill) wrote,
Greg Hewgill

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.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded