GlobeMaker Program

by Jim Chapman
[ Home | Where we live | Jim | Isabel | James | Edward | Nicholas ]

This is a Windows .NET Framework program, which takes an input image (assumed to be in Rectangular a.k.a. Plate Carée projection) and transforms it into an image in 'Interrupted Sinusoidal' projection. For instance, suppose you gave it a black rectangle 512 pixels wide by 256 pixels high:

It would give you back this:

Note that the program does not require that you give it an input image whose width is twice its height - but if you give it something else, you will need a very funny shaped globe. The program does, in any event, let you specify the size of output image you want - your choice here will depend on how large a globe you have, and on various arcane details of your printer. It also lets you specify a certain amount of 'slack' in its calculation, which allows you to create overlaps between the gores (this turns out to be helpful when you come to gluing them onto a globe without leaving any gaps).

The mathematics of the transformation is really quite simple. Lucky really, because I am no mathematician. For puposes of explanation, let's assume that both the input (Rectangular projection) and the output (Interrupted Sinusoidal projection) images range from Y coordinate -90 to +90, and X coordinate -180 to +180 (this is natual for a Rectangular projection, since X coordinate = longitude and Y coordinate = latitude). Let us further assume that we're going to use an Interrupted Sinusoidal projection with a single gore (i.e. no interruption).

Then, the tranformation of (Xin,Yin) to (Xout,Yout) is:

Xout=Xin*cos(Yin)
Yout=Yin

Regarding those two assumptions, the first is just a matter of scaling, and the second is dealt with in a way that is moderately obvious, once you realise that the key constraint you must meet is that the length, in degrees, of any line of latitude is equal to 360*cos(latitude).

For further details, you should refer to the source code. In looking at it, you should bear in mind that it actually does this transformation backwards (it iterates over each point in the output image, finds the corresponding location in the input image, and gets the colour values from that location (probably by interpolation between the four neighbouring points). You will see also that the actual handling of JPEG files is done by a PajantImage control. I bought a licence and a key to use this, if you want to do development on this code, you will have to do the same. All the project files and the un-HTML-ised source are in this zip archive.

If you just want to run the programme, it is in this zip archive, and you can run it to your heart's content without any need for licence keys or anything.

All the source code here is free for your use, under the terms of the GPL. Infringement of these could lead to an ugly law-suit from the Free Software Foundation, possibly accompanied by the death of everyone you know in a series of bizarre yachting accidents.


home@jim-chapman.net