Closed AlexandraKapp closed 3 years ago
I just checked - this issue seemed to have been solved with this fix https://github.com/ATFutures/gtfs-router/issues/77#issuecomment-789693393
library(gtfsrouter)
packageVersion("gtfsrouter")
#> [1] '0.0.4.186'
gtfs <- extract_gtfs("C:/Users/AlexandraKapp/Documents/03_GitHub/travel_time_index/data/Frankfurt/gtfs.zip")
#> > Unzipping GTFS archivev Unzipped GTFS archive
#> > Extracting GTFS feedv Extracted GTFS feed
#> > Converting stop times to secondsv Converted stop times to seconds
#> > Converting transfer times to secondsv Converted transfer times to seconds
gtfs$calendar[1,]
#> service_id monday tuesday wednesday thursday friday saturday sunday
#> 1: 1 0 0 0 0 1 1 0
#> start_date end_date
#> 1: 20201218 20211211
ttable <- gtfs_timetable(gtfs, day = "tuesday")
ttimes <- gtfs_traveltimes(ttable, "D_de:06412:1008", from_is_id = T, start_time = 8*3600)
ttimes[grepl("Frankfurt \\(Main\\) Hauptbahnhof/M", ttimes$stop_name),]
#> start_time duration ntransfers stop_id
#> 2538 08:25:00 00:22:00 2 de:06412:8:2:2
#> 7317 08:20:00 00:15:00 1 de:06412:8:1
#> stop_name stop_lon stop_lat
#> 2538 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.665997 50.10694
#> 7317 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.666445 50.10691
gtfs_transfers <- gtfs$transfers[, c("from_stop_id", "to_stop_id", "transfer_type", "min_transfer_time")]
custom_transfers <- gtfsrouter::gtfs_transfer_table(gtfs, network_times = FALSE)
#> > Finding neighbouring services for each stop
#> Loading required namespace: geodist
#> Loading required namespace: pbapply
#> v Found neighbouring services for each stop
#> > Expanding to include in-place transfers
#> v Expanded to include in-place transfers
gtfs$transfers <- custom_transfers
ttable <- gtfs_timetable(gtfs, day = "tuesday")
ttimes <- gtfs_traveltimes(ttable, "D_de:06412:1008", from_is_id = T, start_time = 8*3600)
ttimes[grepl("Frankfurt \\(Main\\) Hauptbahnhof/M", ttimes$stop_name),]
#> start_time duration ntransfers stop_id
#> 2538 08:09:00 00:29:00 2 de:06412:8:2:2
#> 7317 08:14:00 00:14:00 1 de:06412:8:1
#> stop_name stop_lon stop_lat
#> 2538 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.665997 50.10694
#> 7317 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.666445 50.10691
mixed_transfers <- dplyr::distinct(rbind(gtfs_transfers, custom_transfers), from_stop_id, to_stop_id, transfer_type, .keep_all = T)
gtfs$transfers <- mixed_transfers
ttable <- gtfs_timetable(gtfs, day = "tuesday")
ttimes <- gtfs_traveltimes(ttable, "D_de:06412:1008", from_is_id = T, start_time = 8*3600)
ttimes[grepl("Frankfurt \\(Main\\) Hauptbahnhof/M", ttimes$stop_name),]
#> start_time duration ntransfers stop_id
#> 2538 08:14:00 00:20:00 2 de:06412:8:2:2
#> 7317 08:14:00 00:14:00 1 de:06412:8:1
#> stop_name stop_lon stop_lat
#> 2538 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.665997 50.10694
#> 7317 Frankfurt (Main) Hauptbahnhof/Münchener Straße 8.666445 50.10691
<sup>Created on 2021-03-04 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup>
That's great, thanks for checking. Do you want to close then? Slowly getting all of these done, on the way to CRAN update asap.
I'm not sure if I have a major mistake in thinking here:
The idea - there is a
transfers.txt
but it does not necessarily cover all possible transfers, so I want to also add close by stops as transfers viagtfs_transfer_table()
. So I combine both transfer data tables, using transfer times fromtransfers.txt
if present, otherwise the custom ones. Now I get for some cases impossible fast results with the combination that are not returned if only using each single one of the transfer data tables.How is that possible? (Or is there a reason why I cannot proceed like that?)
I am using the Frankfurt GTFS from DELFI (I'll send it to you). The 3 minutes travel time in the last result are not possible and I did not find the route / transfer that it is based on.
Created on 2021-02-12 by the reprex package (v0.3.0)