How many kilometers of cycle paths in some European cities? Note that the code lives here.
We want to find the total distance of cycle paths in these 6 cities:
Antwerp - Belgium
Barcelona - Spain
London - UK
Örebro - Sweden
Roma - Italy
Vienna - Austria
Zürich - Switzerland.
First step, let’s create a spatial data frame for each city containing its boundaries (or in the case of London, the boundaries of all its boroughs). It will also be the occasion to get the coordinates for a bounding box containing the whole city.
The country code are 3-letter ISO country codes, that one can get in the countrycode R package for instance.
Since the cities are at different level of administrative divisions depending on the country, we’ll find the boundaries of each city separately. Each time, we draw a map for visual checks of the boundary (best way to see we have the city of Barcelona and not the province of Barcelona, for instance).
I got the boundaries for the tätort (city) Örebro from lantmateriet here. The documentation (in Swedish) gives the “MY_riks” layer where the 303 code represents tätort boundaries. The projection is SWEREF 99 TM. The original data is to big to be included here and I don’t own the data anyway.
I downloaded the shapefile for “Località italiane” from the Istituto nazionale di statistica at this link. It’s too big to be included in the Github repository and I don’t own the data anyway. The projection was ED50 / UTM zone 32N.
Now we use OSM for finding cycle paths in each city, and then sum the distances of all paths. As Barcelona locals, we can see some cycle paths are missing, so the distances are most certainly under-estimation of actual cycling infrastructure. Who’s in for a mapathon?
Moreover, some tracks seem to have been geocoded twice with different labels but also different points so their distance is added twice to the sum.
Regarding labels for cycle paths, there’s an interesting article here that shows how complex it is. Here we use three labels: “cycleway-lane”, “cycleway-track” and “highway-cycleway”.
Now that we have made the queries, we’ll show the map and distances (in km).
| cityshort | distance_cycleway_lane | distance_cycleway_track | distance_highway_cycleway | distance |
|---|---|---|---|---|
| Antwerpen | 14.226315 | 151.927563 | 248.03143 | 414.18530 |
| Barcelona | 11.949352 | 3.237314 | 127.91439 | 143.10105 |
| London | 186.233883 | 113.868025 | 628.15516 | 928.25707 |
| Oerebro | NA | 1.321230 | 297.15104 | 298.47227 |
| Roma | 1.549904 | NA | 94.43870 | 95.98860 |
| Vienna | 88.577559 | 26.919628 | 494.56911 | 610.06630 |
| Zurich | 41.063031 | 17.640361 | 40.85834 | 99.56173 |