I wanted to visualize the paths taken by riders of the Munich bike sharing system. Unique about this system is that there are no fixed stations as bikes can be rented and returned at any street corner within the city limits, resulting in much more interesting data than in station-based systems. As the bikes register their coordinates when free, repeated polling of the free bikes on the system’s website and tracking their locations can give reasonably accurate measures about the trips taken. I used openstreetmaps cycle-path data to turn the start and end locations into approximations of the routes taken. While this allows for several statistics to be made about the driving habits, the most visual result is a live replay using the recovered times and routes, which I have embedded below. Note: This is a write up of a project I did in 2014 so the data is a bit older
The map can be navigated by dragging the tiles and using the mouse wheel for zoom.
The data acquisition was done as web crawler in C#, using OpenStreetMap and YOURS for the approximation of the taken routes. For each bike and trip, a list of waypoints with approximated timing information was generated, which is consumed by the frontend as JSON file. The frontend was created using typescript, while mapping functionality was implemented using OpenLayers with contrast reduced maps from MapBox.
As the bike systems website provides the locations of all bikes with their internal ids in JSON format, only a simple repeated download was needed. Once a bike disappears from the available bikes list, it is marked as on-trip and when it later re-appears at a different location, the origin and destination are emitted as trip. These origin-destination pairs were resolved to driving instructions using the YOURS web service in cycling mode, as setting up the dependencies for a local installation were relatively high. Processing the trips during the crawling, however, allowed me to stay well within their fair-use policy. The resulting trips with detailed way-points for drawing them were then dumped into JSON files chunked into time periods.
The frontend consumes the JSON files and renders the movements on the map. At the root lies an application class that runs an internal clock mapped to the simulation time frame. Any movements are handled within the bike objects, which move their markers based on the clock trigger. The marker objects are then responsible for rendering the icons on the map and animating the movement. If a bikes rendering runs behind the clock, it is allowed to complete its current move but following moves are executed without animation until the lag is eliminated, resulting in a good trade-off between smooth animation and simulation correctness.
The frontend is released under an MIT license on GitHub