Categories
Map Switzerland

The Trams of Zurich animated

After I saw a great post on /r/dataisbeautiful where someone mapped a place with the help of location-data of rented bicycles, I searched if there is some similar data available where I live.

I didn’t find anything, but it gave me the idea to animate the position of the Tram of Zurich. The data was available, so I gave it a try. I used R and the dplyr-library to prepare and filter the necessary data. I decided for 15 minutes in the afternoon on the 04.08.17.

To visualize and animate the whole thing I used the libraries ggplot2, gganimate and tweenr. Because I didn’t work with gganimate before this blogpost was very helpful to me.

To make the whole thing more understandable I added a satellite image from google maps. I am quite happy with the result. There is a problem tough, that the points just move in straight lines between the stops and ignore curves. But it isn’t too noticeable.