Read the statement by Michael Teeuw here.
MMM-transitfeed - upcoming departure board for most transit agencies
-
@bnitkin cool module thank you. when i was building my mirror i wanted to ad another bus company schedule which uses GTFS.
-
@0livia Thanks! I’d like to add realtime support, but the format’s a little harder to work with. It’d also be cool to add little bus/train icons, but I wanted to make sure the base thing worked first.
-
@bnitkin I am beating my head trying to get the Virginia Railway into this module.
I went https://transitfeeds.com/p/virginia-railway-express/250 and pulled the link to the latest download. I added it to my config
config: { gtfs_config: { agencies: [ { "url": "https://transitfeeds.com/p/virginia-railway-express/250/latest/download", exclude: ['shapes'] }, ], }, // Route + station pairs to monitor for departures queries: [ {route_name: "Fredericksburg Line", stop_name: "Lorton"}, ], showStationNames: false, }
I get no trips found yet. Check queries in the config if this persists. I can get this to work with your config in the readme.
I have even looked at https://www.vre.org/sites/vre/assets/File/pdfs/MobileDevelopersGuideweb.pdf
and tried http://www.vre.org/gtfs/google_transit.zipAny help would be appreciated!
-
@rnieto18 Thanks for reporting that! You’re doing everything right; there was a parsing disagreement between my script and Virginia Railway. You should be able to pull from
main
(or just restart magicmirror; I think it auto-updates?) and be back in business.GTFS supports calendars so transit agencies can report different service on weekdays vs weekends or special holiday service. That means a single GTFS trip usually corresponds to M-F service under the same trip ID.
MMM-transitfeed
looks up the calendar for each trip to generate daily schedules. Virginia Rail has a single calendar calledRegular
, but the trips reference other calendars likeSummer
andDay After Thanksgiving
.My script was looking up those nonexistent calendars and crashing when it tried to extract service from them. I’ve fixed it to not examine calendars that don’t exist.
Let me know if it works, or if you’re still having trouble!
– Ben
-
@bnitkin said in MMM-transitfeed - upcoming departure board for most transit agencies:
@rnieto18 Thanks for reporting that! You’re doing everything right; there was a parsing disagreement between my script and Virginia Railway. You should be able to pull from
main
(or just restart magicmirror; I think it auto-updates?) and be back in business.GTFS supports calendars so transit agencies can report different service on weekdays vs weekends or special holiday service. That means a single GTFS trip usually corresponds to M-F service under the same trip ID.
MMM-transitfeed
looks up the calendar for each trip to generate daily schedules. Virginia Rail has a single calendar calledRegular
, but the trips reference other calendars likeSummer
andDay After Thanksgiving
.My script was looking up those nonexistent calendars and crashing when it tried to extract service from them. I’ve fixed it to not examine calendars that don’t exist.
Let me know if it works, or if you’re still having trouble!
– Ben
Thank You!! works great now
-
@bnitkin Hello,
This is an awesome project and it’s pretty much what i’m looking for for my MagicMirror (we don’t have dedicated module for Paris :( ).
I have an issue though, as Paris is a very large city and as all our transport are regrouped into one GTFS (for the 3 next month) we get a stop_time.txt with 9 millions lines which is too much too handle for my Raspberry.
Would it be possible to add a limit to the line that are extracted as we don’t need the timetable for the next 3 month but at most for the next week.
Here the link to the GTFS if you want to take a peak : https://data.iledefrance-mobilites.fr/explore/dataset/offre-horaires-tc-gtfs-idfm/files/a925e164271e4bca93433756d6a340d1/download/
I’d be delighted if you could help me with this issue.
Best regards
-
@Nisnis39 I don’t have a great answer, but might have a solution.
These folks talk about the same issue of pruning, and that GTFS isn’t really organized by month. Internally, it assigns services to weekly calendars, and gives each calendar an effective time.
For instance, a train might depart Trenton at 2:00 and arrive in Philly at 3:00 on the
Weekday
calendar. And that calendar’s effective Monday-Friday from 3/3/2022-8/8/2023. So the next month of service is the same amount of data as the next 3 since it’s just the same trip over and over (unless Paris schedules change absolutely all the time).I think prefiltering will work for you. The Stackoverflow question mentions using Transitland to manipulate GTFS files.
If you extract
IDFM-gtfs.zip
and look atagency.txt
, it calls out a bunch of different Paris transit providers:agency_id,agency_name,agency_url,agency_timezone,agency_lang,agency_phone,agency_fare_url,agency_email IDFM:71,RER,http://www.navitia.io/,Europe/Paris,,,, IDFM:55,Noctilien,http://www.navitia.io/,Europe/Paris,,,, IDFM:93,TER,http://www.navitia.io/,Europe/Paris,,,, IDFM:1046,Transilien,http://www.navitia.io/,Europe/Paris,,,, IDFM:1069,Terres d'Envol,http://www.navitia.io/,Europe/Paris,,,, IDFM:1051,Poissy - Les Mureaux,http://www.navitia.io/,Europe/Paris,,,, IDFM:65,Phébus,http://www.navitia.io/,Europe/Paris,,,, ...
Transitland can prune the routes down to the agencies (or routes) you’re interested in. Since it’s written in Go it’s much faster than the
npm
gtfs
library. The releases link above has compiled downloads for Windows & Linux.This will extract all routes served by
IDFM:71
(RER) andIDFM:65
(Phébus). Replace with whichever agencies you’re actually interested in. It might work on the Pi or you might need a real computer:./transitland-linux extract -extract-agency IDFM:71 -extract-agency IDFM:65 IDFM-gtfs.zip pruned.zip
Once you have a pruned GTFS file, swap that into the MagicMirror config (note
path
instead ofurl
):gtfs_config: { agencies: [ { "path": "/path/to/pruned.zip", // Excluding shapes makes loading faster. exclude: ['shapes'] }, ...
There are some shortcomings. The pruned file is a snapshot and won’t update if schedules change, and it’s obviously extra work.
If you can find individual GTFS sources for the agencies that operate your routes, that’d be much easier. Merging ~100 agencies in the region together is a ton of data.
You could also try fishing in the GTFS library for exclusions and optimizations. It supports excluding individual files (like shapes), but doesn’t seem to have filtering on route/agency/calendar at import-time. If you find something promising, let me know - I’m happy to take pull requests or try things out!
-
@bnitkin Thank you, I’ll do as you instructed and will be pruning the GTFS in order to lighten it.
You’re right, except for road work, timetable don’t change a week to another.Sadly individual GTFS source don’t exist anymore as the autority that manage transport in Paris has decided to centralize everything (for the best and the worst).
Thank you again :)