Last updated 2016-02-20.
Kartalla displays in real-time the location of public transport vehicles in Finland based on the position, route and timetable information published by HSL and Finnish Transport Agency as open data. If measured vehicle positions are not available then positions are computed based on route and timetable information. Measured vehicle positions are available only for some HSL routes. Whether measured or computed positions are used the shown vehicle position may and is even likely to differ from the actual location.
The location is presented as an icon colored based on the type of the vehicle (bus, train, tram, metro, ferry or airplane). The visibility of the icons by type can be controlled by the buttons below the map. The form of the icon is a square for one minute before the departure time and a circle for one minute after the arrival time. In between the form of the icon is an array pointing into the direction the vehicle is moving to. Information like in the following example is shown when pointer is moved over an icon (computed vehicle position).
When measured vehicle positions are used the route name is shown inside a white circle in the vehicle icon. The longer the duration from the last position measurement the more transparent the icon is. The duration is also shown as Update in the route information.
Here are some maps displaying the location of public transport vehicles based on measured location.
Kartalla consists of two parts: gtfs2json and browser based graphical user interface. The former formats the route and timetable data published in GTFS format into compressed format more suitable for the latter to use. The source code of both parts is available at GitHub.
gtfs2json compresses GTFS files (calendar.txt, calendar_dates.txt, routes.txt, shapes.txt, stop_times.txt, stops.txt, trips.txt) into one JSON file. The size of HSL GTFS files is about 400-600 megabytes (40-60 megabytes in ZIP format) and the size of the JSON file is about 3 megabytes. The high compression ratio is achieved by skipping irrelevant parts in GTFS files and encoding the relevant parts in less verbose form. gtfs2json is implemented in Python programming language (version 2.7).
Measured vehicle positions are downloaded in JSON format from HSL's server using MQTT protocol.
Information like in the following example is shown when pointer is moved over the word Data below the map.
The user interface can be controlled with the following URL parameters.
Following are examples of the usage of the parameters.
Panu Ranta, email@example.com