Exploring Paris with D3, OpenStreetMap, and Mapbox
October 2020
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 Harold Fisk's Mississippi River maps.
After seeing those visualizations, I wanted to create something similar. I usually use Python's matplotlib
for all my plotting adventures. But, the only option to draw geographic data with matplotlib
that I found online 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. 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 thing that really fascinates me about the city is its metro system.
On the official metro maps the courses of the routes are twisted and distorted for simplicity. I wanted to know how they ran in reality. 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?
This is because the tunnels were constructed by ripping open (and rebuilding) the streets. I learned that there's also a less brutal alternative, which is to use a sort of giant drill underground. The latter allows 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.
While searching around for interesting datasets, I discovered that you can query OpenStreetMap for very specific data via their Overpass API. These contour plots show the spatial distributions of restaurants filtered by cuisine:
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, and is conversely called agglomeration diseconomies. One example are high rents in large cities.
Data sources
- Metro routes from data.iledefrance-mobilites.fr
- Arrondissements from data.gouv.fr
- Vector tiles from Mapbox
- Restaurant locations from OpenStreetMap
Footnotes
- D3 I mean, not ruling the world.