The most recent version of the code used in this page (which might be a little different from the one here) can be found here.

Working on a poster with my postdoc, a problem came up where we wanted to increase the transparency of a map downloaded (and plotted) with OpenStreetMap, because the points we were plotting on it were not really visible. The solution is very simple. It goes without saying that you will need the OpenStreetMap library installed.

The first thing to do is to create a function to add an alpha value to the hexadecimal colour codes used in the OpenStreetMap library. Note that we assume an alpha value in [0,1].

Let us load a map of a small region in Winnipeg. We first need the coordinates of the upper left and lower right corners of the box we want to download.

We also need to specify a map type. We take a cute map type in which alpha effect is easy to see.