roataway / infrastructure-data

Data sets related to public transport in Chișinău
Other
2 stars 2 forks source link
chisinau moldova open-data openstreetmap public-transport

Overview

This repository is related to https://github.com/roataway/web-ui and it contains information about the transport infrastructure of a city:

The process of obtaining the data

Route segments

These are obtained via the Overpass API.

  1. Go to
    https://overpass-api.de/api/interpreter?data=[out:json];relation%20(xxxxxxx)%3B>>%3Bway._%3Bout%20geom%3B
  2. Replace xxxxxxx with the relation id, e.g. 8649765
  3. Save the resulting JSON to data/route_<upstream_id>_segments.json, replacing upstream_id with the route's internal identifier in the upstream GPS tracking system.
// URL query as Overpass query
[out:json];
relation (8649765);
>>;
way._;
out geom;

Route stations

The process is similar to route segments, but the Overpass API query is different:

  1. Go to
    https://overpass-api.de/api/interpreter?data=[out:json];relation%20(xxxxxxx)%3B>>%3Bnode._%20[public_transport%3Dplatform]%3Bout%3B
  2. Replace xxxxxxx with the relation id, e.g. 8649765
  3. Save the resulting JSON to data/route_<upstream_id>_stations.json, replacing upstream_id with the route's internal identifier in the RTEC system.
// URL query as Overpass query
[out:json];
relation (8649765);
>>;
node._[public_transport=platform];
out;

Overpass queries can be tested at https://overpass-turbo.eu/

CSV files

Some of the information is stored in CSV files, to make it easier for stakeholders from the public transport industry directly contribute to the repository, supplying fresh data. It is assumed that they are familiar with how to use spreadsheets, so CSV is appropriate because it allows them to edit it as a table.

These details are obtained through personal observations and through interactions with RTEC staff.

Route information

id_upstream name_concise name_long osm_relation
1 30 Aeroport - str. 31 August 1989 7390177
2 32 Stăuceni - Chișinău 8649765
37 Bubuieci - Gara Feroviară 9478330

Note that not all trolleybuses have GPS trackers yet, therefore not all routes are provisioned in the tracking system, and we don't know their id_upstream. In this case we simply omit it. These routes will not be shown in the interface.

Vehicles

The fields are:

tracker_id organization board vehicle_type model door_count release_date articulated accessibility
000004 PT-1 1232 trolleybus ZiU/9 3 01/11/1989
PT-1 1278 trolleybus BKM/AKSM-213 4 15/11/2005 yes
PT-1 1285 trolleybus BKM/AKSM-321 3 27/04/2011 yes
PT-1 1286 trolleybus BKM/AKSM-321 3 27/04/2011 yes

Note that at the moment not all vehicles are equipped with GPS trackers, hence the tracker_id field is empty for them. This information will be updated once more trackers are deployed.

Helper tools

getRoute - automatically retrieve routes metadata from OpenStreetMap.

This tool retrieves information about a given route, by taking all routes from a CSV file that was fed into it, or by explicitly retrieving one particular route specified by its OpenStreetMap relation id.

The data are stored in GeoJSON, in 2 files:

Installation:

Examples of use (activate the virtualenv via source venv-getRoute/bin/activate first):

If all is well, you will see something like this:

 INFO - Processing all routes from ../src/data/routes.csv
 INFO - Processing route 30, `Aeroport - Piața Marii Adunări Naționale`
 INFO - Processing route 32, `str. 31 August 1989 - com. Stăuceni`
 ...
 INFO - Processing route 1, `or. Durlești - str. Sarmizegetusa`
 INFO - Done

And the metadata will be saved in the directory you've indicated.

Note that the Overpass API of OSM returns a JSON which does not conform to the GeoJSON schema (though they look the same to the untrained eye)! Thus, the tool relies on a third-party library, osm2geojson to do the conversion.

What happens in principle: