Map projections

In many cases we need maps to show the physical coordinates of an important place or speak about an event that happened there. What we may not know is that this place can be presented in many different ways with varying context. For instance, if we look at a globe that we can spin with our hands, we can see that the points closest to our eye look normal, while distant points may look slightly distorted, depending on the angle at which we look at them. If we turn our attention to a map on the wall instead, we see much less distortion, yet this map somehow hides the true nature of the Earth.

Sometimes we can see very simple world maps online and wonder how these were created. It is not very useful to think that someone took a real map and then traced in Photoshop every possible contour of every possible country to obtain such a clear result. Just imagining the number of control points that need to be set this way would raise some questions about our patience. There has to be another way.

We may also be unable to find a map that works particularly well for our purpose and is at the same time not copyright protected. Some maps are overly detailed, while others are lacking enough detail. Some are too big, others are too small. And when they come as a final image, we can't easily fix them or adapt them to our needs.

TV news are relatively good at showing the right amount of map detail. When a reportage is made, only a couple of points and labels are shown together with the contour of the country in discussion. This helps to focus our attention for a short period of time and to more easily digest the individual chunks of information we receive. Since these maps are mostly country-specific and enlarged, they have to vary quickly across different reportages, so there must be a way to generate ones for the right region (once).

Here is how we come to the idea of map projections. A map projection determines the nature of the map, where different projections are suitable for different uses. Here is the orthographic projection of the world map:

Orthographic projection of a map
Fig. 1: Orthographic projection of a map

If we add data points and labels to this map, they can become very hard to distinguish if the locations are very close and the data overlaps. On the other hand, if data points are only few, physically distant and all visible, this map may present the right amount of detail. Here no parallels and meridians have been drawn to keep the map simple. If you need more detail, you can show as many of them as you like. Contours can also be specified on this projection, which could be useful in cases where weather fronts need to be shown.

Then we can see the Robinson projection:

Robinson projection of a map
Fig. 2: Robinson projection of a map

This map is similar to unfolded world map. The country borders are still visible, but now we can see more detail, which was previously hidden on the back of the orthographic projection. Notice how the left and right sides are still distorted.

Finally, we would take a look at the Mercator projection.

Mercator projection of a map
Fig. 3: Mercator projection of a map

The Mercator projection allows us to define a clipping region for which we want to obtain a map. This is done by specifying the latitudes and longitudes of the lower left and upper right point of the map. It helps to view these as ranges that include the minimums and maximums of all latitudes and longitudes of all cities or data points in our dataset. Additionally, we set the latitude and longitude of the center point on the map (the focal point). To make the example more practical, we could try to show where some of the biggest cities in India are located. After getting their names, we can obtain their coordinates and plot them together with their labels. We could also adjust each label position separately with a precision of up to what would correspond to one physical meter, which is very impressive. Although the resulting map isn't perfect, it allows us to learn something new about this country.

This approach has some advantages and disadvantages some of which can be seen in the following table:

Advantages Disadvantages
  • No API key is required. Anyone who has basemap installed can use it to create their own maps.
  • Adjustable: the colors of the countries and the contours can be set according to prefererence. Any clipping region can be chosen after we know the latitude and longitude of each data point. Each label can be adjusted separately to avoid label overlaps. We can present only the amount of detail we need for our particular task: nothing more, nothing less.
  • Programmable: We don't have to manually create contours, set points, type labels. Separating the data from the implementation allows us to reuse our code to generate maps with changing requirements.
  • Full control of our data: We are not limited to the data that an external mapping service returns to us. We can edit and show our own and tell our own stories through it, which seems more flexible.
  • Look and feel: The maps aren't the most beautiful, especially when compared to other mapping services.
  • Lack of interactivity: The maps aren't interactive and can't be dragged around unlike other 3D plots. When the data changes, the script needs to be run again, which is different than sending another query to a server and waiting for the result.
  • Generating some projections can be slow: For instance, at full detail, the orthographic projection can become quite slow. The more parallels and meridians we want to show on it the longer this is likely to take.
  • Lack of selectable layers: There seem to be no easy way to add layers containing roads, buildings and other metadata.

This allows you to find simple maps, which you can then choose to enhance in a graphic editor. The basemap documentation contains further information on map projections if you find them interesting.