-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use detailed_itineraries on Frequency-based GTFS feeds #181
Comments
Thanks for providing this example and great work on the I think this example may not fully solve the upstream integration with R5, however, because it omits So, I recommend the following change to the example (will try out in the next day or two to see if successful and reply back):
Also, I'm not exactly sure |
Hi @cseveren. Thanks for the support and feedback. Yes, you're right. My suggestion above does not work correctly because the In the meantime, I believe your suggestion should work well as a temporary fix. |
One simple short-term solution to this problem would be to:
|
There's another issue with the solution proposed above that utilizes Here's an alternative solution that uses gtfsrouter's
|
Just to let you all know, the development version of The entire workflow can be shortened to: library(gtfstools)
frequencies_gtfs <- read_gtfs("path/to/frequencies/gtfs.zip")
stop_times_gtfs <- frequencies_to_stop_times(frequencies_gtfs)
write_gtfs(stop_times_gtfs, "path/to/stop_times/gtfs.zip") |
@dhersz This is great! One question: Is your implementation different/faster than in I looked through your code and the use of templates seems nice, but I couldn't follow where expanded freqs/trips were being saved. |
@cseveren The implementation is quite different, as you have correctly noted, and I believe it's quite faster as well. The updated frequencies and stop times tables are saved into the gtfs object that is returned by the function. You can check that in the code from the "third step" (based on the comments) onwards. A small benchmark of gtfsrouter's and gtfstools' functions: path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfstools_gtfs <- gtfstools::read_gtfs(path)
gtfsrouter_gtfs <- gtfsrouter::extract_gtfs(path, quiet = TRUE)
microbenchmark::microbenchmark(
cvt_gtfstools_gtfs <- gtfstools::frequencies_to_stop_times(gtfstools_gtfs),
cvt_gtfsrouter_gtfs <- gtfsrouter::frequencies_to_stop_times(gtfsrouter_gtfs),
times = 5L
)
#> Unit: milliseconds
#> expr
#> cvt_gtfstools_gtfs <- gtfstools::frequencies_to_stop_times(gtfstools_gtfs)
#> cvt_gtfsrouter_gtfs <- gtfsrouter::frequencies_to_stop_times(gtfsrouter_gtfs)
#> min lq mean median uq max neval
#> 777.2107 793.785 875.153 925.58 937.2485 941.9406 5
#> 26631.9393 31469.455 31593.529 32363.29 32884.5130 34618.4487 5 (and apparently gtfsrouter's doesn't update the frequencies table, which seems more like a bug than an actual behaviour that should be relied upon) cvt_gtfstools_gtfs$frequencies
#> NULL
cvt_gtfsrouter_gtfs$frequencies
#> trip_id start_time end_time headway_secs
#> 1: CPTM L07-0 14400 17940 720
#> 2: CPTM L07-0 18000 21540 360
#> 3: CPTM L07-0 21600 25140 360
#> 4: CPTM L07-0 25200 28740 360
#> 5: CPTM L07-0 28800 32340 360
#> ---
#> 700: 5290-10-1 79200 82740 1200
#> 701: 5290-10-1 82800 86340 1200
#> 702: 6450-51-0 18000 21540 3600
#> 703: 6450-51-0 21600 25140 3600
#> 704: 6450-51-0 25200 28740 3600 |
@dhersz checks out on my end, works great! thanks. |
We believe the best solution here is to inform users to use the |
could you please share a reproducible example of the error? |
Hello @rafapereirabr have revised my code and my input data, and get another error (below). I believe I will just delete my original comment right now to avoid confusion for other users. I will delete this message too, once you have seen it. I will work on debugging my code a bit more before reaching out again if need be. "Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : |
thanks @1022SO |
The fact that
r5r
does not rundetailed_itineraries
on frequency-based GTFS feeds is a limitation upstream in R5, unfortunately. We hope this will be solved soon.In the meantime, one alternative would be to use the gtfs2gps package to generate a new
stop_time.txt
file and replace it in your GTFS. This example might do the trick:The text was updated successfully, but these errors were encountered: