# Miller Projection

I was talking to my colleague the other day about a problem he was having with a new Location Editor that he was making for the university. The goal of the program was to take Latitude/Longitude coordinates and transpose them to (x,y) coordinates on a image of a map. I do want to put a disclaimer that my colleague basically did all the work to solve this problem. I am merely describing the math of his solution.

In stating the obvious, the planet we live on is basically a sphere. However, because we only live on the surface, we still only have two dimensions to map. However, in order to represent the surface of the earth, we will need some kind of projection which will change (Latitude,Longitude) coordinates to (x,y) coordinates. I am going to be using a World Map which uses a Miller Projection. However, you can easily use a different projection like a Mercator projection or a Gall-Peters projection.

A Miller projection is obtained by projecting all points on the surface of the earth onto a cylinder.

Once you projected the earth onto a cylinder, you can then unroll the cylinder surface onto a plane. If you do this, you will get the following world map.

It can be shown that the x,y coordinates can be obtained by the following relationship. Please note that the longitude and latitude are in radians not degrees.

However, in order to project these x,y coordinates onto an image, we are going to need to change these formulas a bit. First off, the miller coordinates (which I will represent as x’,y’ from now on), assumes the following coordinate system.

The big things to note about the coordinate system is that

1) y=0 runs across the equator.

2) x=0 runs across the prime meridian.

3) The range of possible values are roughly x = 0 .. 6.28 and y =-2.30 .. 2.30.

However, we don’t care about the Miller Coordinate system. We want to use the coordinate system of the image. First off, the image coordinate system uses pixels as a unit length instead of a miller unit. Secondly, the y axis in the image coordinate system is in the opposite direction as the miller y’ axis. This is because (x,y)=(0px,0px) should be the top-left corner of the image which is the standard coordinate system that computers use for images. And lastly, the image doesn’t have to be the entire world map. The image could be an image of North America instead of the World.

This means we will have to apply the following projections .

First, before I describe the transformation, I want to define the following constants:

As I mentioned above, the Miller projections are defined as:

All we need to do is to apply the following transformation to get from (long, lat) to (x, y).

The nice thing about this formula is that it is really easy to move to a map with a different projection. All you need to do is to apply a different projection function for and . For example, the Mercator projection would have the functions: