@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 at agency.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) and IDFM: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 of url
):
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!