Information about active/inactive elevators at the train/metro stations in Stockholm
Hi,
referring to the question from Gustaf on 18.11.2019: Status på rulltrappor och hissar. Please advise if this information about the working/broken elevators is available now.
Thank you!
referring to the question from Gustaf on 18.11.2019: Status på rulltrappor och hissar. Please advise if this information about the working/broken elevators is available now.
Thank you!
Följ inlägget
0
följare
Unfortunately this information is not available in a structured format (such as a list of all elevators and escalators). There are however two APIs which provide access to "status messages" from operators, where they also can announce broken elevators and escalators.
These messages can be obtained through the following APIs:
- GTFS Regional Realtime API, to be more specific through the ServiceAlerts feed, which contains all messages for a given operator.
- SL Störningsinformation 2, which contains the same data, but then on a per-station basis. This means you would need an excessive amount of API calls to check the entire network. Therefore I would recommend you to use the GTFS-RT feed which contains the status for the entire network in one file.
An example message from the GTFS-RT feed right now: When using data from the GTFS-RT feed, you will notice there is a stop_id included, which matches the GTFS Regional static data. This way you can get more information about the exact stop which is affected.
Hope this helps.
Regards,
Bert
What do I do with the .pb file that I have received as a combination of the location+API key?
I could, of course, manually review the document and extract all the data related to the elevators, but may be there is a smarter way around it?
Thank you!
For the file format, please see the examples here: https://developers.google.com/transit/gtfs-realtime/examples/python-sample
The data is unstructured (they are human-readable messages, not meant for machines) so the best approach is probably to loop through all the messages, and keeping those that contain " hiss " or " rulltrapp ". You can then check which messages are kept, and adjust your filter until you only keep relevant messages. Regular expressions might be helpful in doing this.
Thereafter, it's up to you to do what you want with the data.
Regards,
Bert