Programming

Google Maps Projection

Say you have a map like this (I think this is just cylindrical mapping) where the y (latitude) scale ranges from -pi/2 to pi/2 (corresponding linearly to the actual -90 to 90 degrees latitude on an actual globe; x coordinates are simply a linear mapping from -180 to 180 degrees longitude):

but you want a Mercator projected map like this (where, incidentally the latitude only ranges from +/-85.05113 degrees):

The transformation is rather simple, despite the multitude of formulae on the Wikipedia article on the Mercator Projection. Simply take each y value in the range -pi/2 to pi/2, and plug it into: y_new = atan(sinh(2 * y_old)) That's it. (BTW the output y_new values are still (roughly) in the range -pi/2 to pi/2.) Here's what you get:

Now you can do interesting things like use NASA's Blue Marble data or USGS Digital Elevation Model data to create your own Google Maps compatible map!

(Note: I didn't create this particular Relief map but I've got most of the pieces in place to do so. Stay tuned.)

Archive