The gender income gap, squared
November 14th, 2024
3 min
This article is brought to you by Datawrapper, a data visualization tool for creating charts, maps, and tables. Learn more.
Hey, this is Eddie from the support team at Datawrapper. The team seems to be fascinated by maps lately, so I decided to follow Margaux and Becca’s lead and make maps for the third Weekly Chart in a row. This week, I looked at bike lanes in several cities around the world to see how much space they take up.
Lately, I’ve become quite interested in how people are claiming the streets back from cars. One of the ways to achieve this is through bike lanes. In Madrid, where I grew up, these are rare to see and you are considered courageous if you venture through the city center with your bike. A 2017 survey ranked Madrid as the worst city for cycling in Spain. Aggressive traffic and very few bike paths make the capital a dangerous zone for cycling enthusiasts.
The good news is that most of the world’s cities show a very different picture, and are making room on their streets for walkers and cyclists. This became especially true during the pandemic. Several cities created temporary bike lanes to give more space to cyclists and pedestrians so that they could move around while maintaining social distance. General concern for our planet has also led more people to take up cycling, or at least get interested in it. The British newspaper The Guardian even has now a biking blog.
To get a better understanding of how much space different cities around the world leave for their cyclists, I decided to visualize bike lanes in America, Europe, Africa, Asia, and Australia, and compare the length of the routes to the cities’ populations. Here are the results:
Looking at these numbers, I was not surprised to learn that cities like Amsterdam, Berlin, and New York are a paradise for cyclists. That said, I was saddened to discover the lack of data for many cities in Africa and Latin America, which makes it difficult to get a fuller picture of the situation.
The maps above are one of the three map types you can create in Datawrapper: locator maps. While I have some experience with this map type (like this one showing dams on the Nile), I had never created a locator map showing routes — so I had a lot to learn this week. If you want to create them as well, I would recommend you start by reading these articles from our Academy, which were a big help to me:
And now, on to the process!
Before I could create the maps, I had to first get the spatial files for the bike lanes. For this, I used Overpass Turbo, an API that allows you to query the entire OpenStreetMap database and get selected parts of the map back.
First, you'll look for the area that you want to query: for example, Madrid
. Then, you'll write the query in the console, and click on execute
The query I used looks for routes that are specific to bikes. That's the parameter ["route"="bicycle"]
.
[out:json][timeout:25];
(
way["route"="bicycle"]({{bbox}});
relation["route"="bicycle"]({{bbox}});
);
out body;
>;
out skel qt;
Once I got the file of bike lanes, I had to trim them so that they fit the area for each city. I used Mapshaper for this purpose. This tool is free and open-source, and you can use it directly in your browser to convert, edit, and simplify geospatial files.
First, I uploaded two files: one containing the bike lanes, and one I downloaded with the outline of each city (which I called region
), as a reference for the trimming. Then, I ran the following command:
-clean
-clip region
-dissolve
Clip
removes the lines that didn't fit my map, and dissolve
combines all the lines into one object.
Finally, I had to calculate the total length of the lines so that I could get an idea of how many kilometers each city dedicated to bike lanes. For that, I used the following command:
each 'len=this.length'
Before exporting the trimmed lanes, I simplified them directly in Mapshaper to make sure the GeoJSON was under 2MB, which is the maximum size you can upload into Datawrapper. After clicking on Simplify at the top right corner, make sure you select prevent shape removal so that the features of your map won't disappear from oversimplification.
Once I had all of my files ready, creating the nine maps in Datawrapper was very simple. I first searched for each city in Add region as an area marker. After that, I imported my GeoJSON containing the bike lanes. I styled the map using different colors and in step 3: Visualize, I selected roads under Map styles for some additional context. Although you might be familiar with the shape and size of some of these cities, others might be completely new to you, so I thought that would help!
I hope that gives you a better idea of how you can show routes in our locator maps. If you try this out and have any questions, don't hesitate to send me an email!
That's all from me this week! Thanks for reading, and I hope you learned a bit more about bike lanes around the world. Don’t hesitate to share your thoughts with me at edurne@datawrapper.de or my Twitter, @edurnemg. Special thanks this week to our cartographer Anna, who helped me a lot with Overpass Turbo and Mapshaper. Next week, it will be our writer Rose's turn to write a Weekly Chart. She also proofread this text and gave me feedback for the blog post, so big thanks for that!
I hope you've all been enjoying your local bike lanes during the pandemic! Here are some resources to learn more about urban mobility around the world:
Comments