Felix Böhm

Exploring Paris with D3, OpenStreetMap, and Mapbox

October 2020 Home

I recently read Alberto Cairo's The Truthful Art, and was captivated by how beautiful geographic visualizations can be. Some of them are practically artworks, like the maps of the historical traces of the Mississippi River by Harold Fisk.

After seeing those charts, I wanted to create something similar. To date, I've used Python's matplotlib for all my plotting needs. But, the only option with matplotlib that I found was to use a screenshot from OpenStreetMap as a background image. Hm.

I wanted pretty visualizations, so I needed something else. I had already heard of D3 and that the Web will one day rule the world and everything. This was the perfect opportunity to try it out.

Le métro de Paris

During my Bachelor's, I spent a year studying in Paris and enjoyed my time there a lot. One of the things that fascinates me about this city is its metro (It seems I'm not alone here, people have written poems about it).

I was familiar with the simplified courses of the lines from the boxy metro maps, but not their real-life routes. So I pulled the data from the operator's website, hit some buttons, worked some D3 magic, and voilà!

You can click through the legend to highlight individual lines:

If you look closely, you can see that the metro network almost exactly follows the road network. Weird, right?

It's because the tunnels were constructed by ripping open the streets and rebuilding them afterward. There exists a less brutal alternative, which is to use a sort of giant drill underground. This would allow for a more flexible layout and less disruption, but is generally slower and more expensive.

Where to eat?

The next chart is about food, another Parisian specialty. I discovered that you can query OpenStreetMap for very specific data via their Overpass API. I downloaded the locations of restaurants filtered by cuisine, and drew contour plots of their respective spatial distributions:

It seems to be pretty common for Parisian restaurants of the same cuisine to be grouped together. My guess is that this makes production easier and cheaper, an effect called economies of agglomeration.

In the case of restaurants, clustering could for instance make specialized local suppliers economically feasible. On the map, we can see that there are a lot of Chinese and South East Asian restaurants located in the 13th arrondissement — in the southeast of Paris — where incidentally a big Asian supermarket chain called Tang Frères is also based in.

Interestingly enough, the opposite effect exists as well, where clustering has negative impacts. It's called agglomeration diseconomies. One example: high rents in large cities.

Data sources


  1. D3 I mean, not ruling the world.