Prototyping a Smoother Map
By: Antin Harasymiv
Tags: JavaScript, UX, Maps, Google Maps, Web Development

1. Making the Earth flat

I hope it won’t come as a surprise to anyone, but the world is round — although curiously enough, it is not actually a sphere, but rather slightly squished and wider at the middle.

The process of taking this mostly-spherical object and representing it in 2D is something that cartographers have been struggling with, and arguing over, for millennia. There is actually no “best” way to do it, each comes with tradeoffs.

Latitude and Longitude

If you imagine the world as a sphere rotating around its axis, the north pole is at the very top, the south pole is at the very bottom, and the equator is the imaginary line that runs around the middle.

Graticule

If you think of the equator as a circle that sits horizontally (like a belt), then you could imagine additional horizontal circles above and below, each of these parallel to the equator. Following any circle to the right you move due east, following any circle to the left due west. These imaginary lines are called circles of latitude. The latitudes are always the same distance apart from each other, no matter how far east or west you travel.

Because the earth is tilted on its axis, the sun doesn’t always sit directly above the equator, but appears to wander slightly north and south during our orbit. The Tropic of Cancer is the north-most circle of latitude at which the sun can appear directly overhead (on the June solstice), and the Tropic of Capricorn is the equivalent in the southern hemisphere (and the December solstice). That’s not actually important for Google Maps, but it’s fun trivia.

Latitude denotes how far north or south you are (because no matter how far east or west you go you have not moved north or south at all).

Running in the other direction, perpendicular to the equator, are the meridians, or lines of longitude — each connect the north pole to the south in a straight line. Following any line up you move due north, following down due south.

Longitude denotes how far east or west you are (because no matter how far north or south you go, you haven’t moved east or west at all).

The crucial difference between latitude and longitude is that while latitude is always an equal distance away on a sphere, the lines of longitude are farthest apart in the middle (the equator) and get closer together near the poles (where they touch).

Measuring latitude and longitude

Both latitude and longitude are measured in degrees. Starting from the center of the sphere you just measure out the angle on each circle (the parallel circles of latitude, and the perpendicular circles of longitude).

Latitude is the angle formed from the equator, so it’s 0º at the equator, and up to 90º North or South (at the poles). Halfway towards the North Pole would be at 45º N.

Longitude is the angle measured from the Prime Meridian (an arbitrary line that runs through Greenwich, England). It’s 0º in Greenwich and up to 180º East or West (the opposite side of the world).

Global Positioning

A final bit of trivia, that doesn’t really matter to Google Maps (but I find interesting nonetheless), is how people located themselves prior to GPS.

Latitude is relatively simple, you just need to measure the angle between the horizon and a known star (or our sun) and then do a little math. People have been navigating based on the stars for thousands of years, Polaris (the North Star) is especially popular — at the North Pole, Polaris is directly overhead (at 90º to the horizon). At the equator, Polaris appears to sit on the horizon (at 0º). In-between these two extremes the angle to Polaris is the angle of latitude North. You can use others stars too, they just require more math.

Longitude is much, much, harder — in fact so hard that nobody could do it well until the late 1700s (nor easily until much later than that). The solution involves time — the earth rotates at the same speed, 360º every 24 hours (or 15º per hour), so if you know the time where you started and the time where you are, you can calculate the distance based on the difference. Easy to do today, with accurate clocks, but very hard to do previously.

Originally, they used the predicted positions of celestial bodies at known times to calculate what the time was, and then compared that to the local time (using the sun at noon to reset the “local clock”). The most widely used set of predictions was the Nautical Almanac published by the Royal Observatory in Greenwich, England — which, if you’ve ever wondered why it was called GMT (Greenwich Mean Time), or why the Prime Meridian runs through Greenwich, it’s because for the longest time everyone was measuring relative to the observatory in Greenwich.

The biggest breakthrough in measuring longitude was more accurate clocks so they could cease the stargazing and just check GMT— longitude was the number of hours difference multiplied by 15º. In fact this is pretty much how everyone calculated longitude until the invention of the Global Positioning System (GPS), which is just a set of super accurate atomic clocks sitting in space (and some impressive math).

If you’re half as fascinated by this as I am I’d really recommend reading this great book about it.

Picking a Projection

The method of translating the points on a 3D globe to a 2D plane is called a map projection. There are many different projections, each with their own strengths and limitations, and none without some form of distortion to the actual geometry — here are just a few: