Closed Maxime2506 closed 4 years ago
Ah yes, thanks @Maxime2506 - i see that this feed implements the alternative yet permitted version of calendar_dates
. The package currently can not handle that usage, so I'll have to fix it asap. I'll let you know when it's done ...
Thanks. I think a code to filter_by_date would be useful. I'm writing one ad hoc for my issue, but a general solution is missing.
M.
Le jeu. 17 oct. 2019 à 15:09, mark padgham notifications@github.com a écrit :
Ah yes, thanks @Maxime2506 https://github.com/Maxime2506 - i see that this feed implements the alternative yet permitted version of calendar_dates https://developers.google.com/transit/gtfs/reference/#calendar_datestxt. The package currently can not handle that usage, so I'll have to fix it asap. I'll let you know when it's done ...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ATFutures/gtfs-router/issues/20?email_source=notifications&email_token=ANDRGEYL4Z2F6XCSL7SRVOLQPBPXZA5CNFSM4JBYXDS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBQBC5Q#issuecomment-543166838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANDRGEYEZLVIK4W5Y7RGJXTQPBPXZANCNFSM4JBYXDSQ .
@Maxime2506 the commit referenced above implements a date
parameter for gtfs_timetable
, so you can do the following (noting this won't be enduringly reproducible, because the "latest"
version is downloaded, with dates only extended from approximately now in to the future, so the value of date
will have to be updated to repeat in future cases):
library (gtfsrouter)
url <- "https://transitfeeds.com/p/regie-autonome-des-transports-parisiens/413/latest/download"
f <- "paris-gtfs.zip"
if (!file.exists (f)) download.file (url, destfile = f)
gtfs <- extract_gtfs (f)
gtfs <- gtfs_timetable (gtfs, date = 20191030)
gtfs_route (gtfs, from = "Olympiades", to = "République", start_time = c (9, 0))
#> route_name trip_name stop_name arrival_time
#> 1 14 205 Olympiades 09:01:00
#> 2 14 205 Bibliothèque-François Mitterrand 09:02:00
#> 3 14 205 Cour Saint-Emilion 09:03:00
#> 4 14 205 Bercy 09:05:00
#> 5 14 205 Gare de Lyon 09:06:00
#> 6 14 205 Châtelet 09:10:00
#> 7 11 202 Châtelet 09:17:00
#> 8 11 202 Hôtel de Ville 09:18:00
#> 9 11 202 Rambuteau 09:19:00
#> 10 11 202 Arts-et-Métiers 09:20:00
#> 11 11 202 République 09:22:00
#> departure_time
#> 1 09:01:00
#> 2 09:02:00
#> 3 09:03:00
#> 4 09:05:00
#> 5 09:06:00
#> 6 09:10:00
#> 7 09:17:00
#> 8 09:18:00
#> 9 09:19:00
#> 10 09:20:00
#> 11 09:22:00
Created on 2019-10-17 by the reprex package (v0.3.0)
I'll re-open the issue straight away, to ensure that gtfs_route
without first running gtfs_timetable
issues an appropriate message about needing to filter with an explicit date
. Other than that, does that now work for you? Thanks for finding this little glitch :smile:
This commit ensures that an appropriate error message is issued for feeds which use "calendar_dates"
instead of "calendar"
:
library(gtfsrouter)
url <- "https://transitfeeds.com/p/regie-autonome-des-transports-parisiens/413/latest/download"
f <- "paris-gtfs.zip"
if (!file.exists (f)) download.file (url, destfile = f)
gtfs <- extract_gtfs (f)
gtfs_route (gtfs, from = "Olympiades", to = "République", start_time = c (9, 0))
#> Error: This appears to be a GTFS feed which uses a 'calendar_dates' table instead of 'calendar'.
#> Please first construct timetable for a particular date using 'gtfs_timetable(gtfs, date = <date>)'
#> See https://developers.google.com/transit/gtfs/reference/#calendar_datestxt for details.
gtfs <- gtfs_timetable (gtfs, date = 20191030)
gtfs_route (gtfs, from = "Olympiades", to = "République", start_time = c (9, 0))
#> route_name trip_name stop_name arrival_time
#> 1 14 205 Olympiades 09:01:00
#> 2 14 205 Bibliothèque-François Mitterrand 09:02:00
#> 3 14 205 Cour Saint-Emilion 09:03:00
#> 4 14 205 Bercy 09:05:00
#> 5 14 205 Gare de Lyon 09:06:00
#> 6 14 205 Châtelet 09:10:00
#> 7 11 202 Châtelet 09:17:00
#> 8 11 202 Hôtel de Ville 09:18:00
#> 9 11 202 Rambuteau 09:19:00
#> 10 11 202 Arts-et-Métiers 09:20:00
#> 11 11 202 République 09:22:00
#> departure_time
#> 1 09:01:00
#> 2 09:02:00
#> 3 09:03:00
#> 4 09:05:00
#> 5 09:06:00
#> 6 09:10:00
#> 7 09:17:00
#> 8 09:18:00
#> 9 09:19:00
#> 10 09:20:00
#> 11 09:22:00
Created on 2019-10-18 by the reprex package (v0.3.0)
Hello,
I'm working on a GTFS (RATP - subway in Paris, France) which doesn't define the weekly services by default in Calendar, but defines it day-by-day in Calendar_dates. The function filter_by_day is only looking at Calendar and stops with an error (no service selected)
. The other functions are calling filter_by_day and doesn't work either. Did I miss something?
Maxime
PS : GTFS elements and command
ratp$calendar
A tibble: 4,926 x 10
service_id monday tuesday wednesday thursday friday saturday sunday start_date end_date