Read the statement by Michael Teeuw here.
Realtime data (GTFS) added to MMM-Resrobot timetables (swe) to show buss delay
-
Re: MMM-ResRobot - Public transport information for Sweden
Since Trafiklab also provides a free api to the GTFS files, I wanted to add the delay to the buss timetable that I currently show with the MMM-Resrobot module.
I took a shortcut and added my GTFS-implementation in a fork/branch of MMM-Resrobot, so all creds to the creator of that module!
My branch also contains modificatios that does not only affect the realtime-data that you might not want in your version. I think i hardcoded a filter to only show busses heading towards the city, so you might not want to directly clone my branch without having a look at it first (search for “directionFlag”).
to use:
- create free account in www.trafiklab.se
- create project
- create api-keys for Stops data, ResRobot v2.1 & GTFS Regional Realtime
- find your station ID for the buss-stop
- download “_stops.xml” for sweden:
easiest to do it in the web-browser by browsing:
https://opendata.samtrafiken.se/stopsregister-netex-sweden/sweden.zip?key=\<your API key for Stops data> - find your stop-id called local-stoppoint-gid that matches your buss-stop
this file is very hard to traverse, so i made a script to do it for me: (change “Gävle Domarringen” to your stop and point to where you have the _steps.xml)
perl -0777 -ne 'while (/Gävle Domarringen(?:(?!<\/StopPlace>).)*?local-stoppoint-gid<\/Key>\n *<Value>\d*:(.*?)<\/Value>\n/sg) { print "stop: $1\n" }' data/_stops.xmlwhich outputs something like:
- stop: 9022021480123001
- stop: 9022021480123002
the two stops are on the different sides of the road, and i only wanted the one with the 2 at the end (heading towards town in my case which I found out by looking att the actual data and comparing with the x-trafik-app).
Use this stop-ID in the config.js where I added a GTFSRegionalRealtime, se my example config-setup for resrobot.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login