-
Notifications
You must be signed in to change notification settings - Fork 17
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
Transfers counted incorrectly #88
Comments
Hi @szaboildi, sorry i somehow completely missed this issue. I'm not sure what you mean with the bug here; could you please explain a bit more? You show journeys with transfers, and they both match. Can you please explain why this is different from what you expect? Thanks |
Hi @mpadge , thanks for getting back to me! The issue is basically that this trip shows up as requiring 0 transfers (the (The output of the |
But the documentation for the
Setting |
I probably should update that documentation to change
to the correct version of
|
Thank you for the explanation, that explains the
|
Yes, that |
@szaboildi Sorry that it's taken so long to get back to this. The above commit fixes the bug you uncovered, and you should now see this: library (gtfsrouter)
packageVersion ("gtfsrouter")
#> [1] '0.0.5.91'
url <- "http://daten.transparenz.hamburg.de/Dataport.HmbTG.ZS.Webservice.GetRessource100/GetRessource100.svc/90a29c65-d9c5-4281-a45a-e12bf19a18fb/Upload__HVV_Rohdaten_GTFS_Fpl_20210903.zip"
file <- "./feeds/HVV.zip"
if (!file.exists (file)) {
download.file(url, file, quiet = FALSE)
|
from_trip <- "S Hamburg Airport"
to_trip <- "Langobardenweg"
start_time_trip <- 8 * 3600
day_trip <- 3 # Tuesday
ham_gtfs <- extract_gtfs(file)
#> ▶ Unzipping GTFS archive✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
ham_gtfs <- gtfs_transfer_table (ham_gtfs)
route <- gtfs_route(ham_gtfs, from_trip, to_trip, start_time_trip, day_trip, max_transfers = 0)
# same as above: lists 2 transfers, and takes 39 minutes
ttimes <- gtfs_traveltimes(ham_gtfs, from_trip,
start_time_limits = c(8 * 60 * 60, 9 * 60 * 60),
day = day_trip, max_traveltime = 60 * 60)
ttimes[ttimes$stop_name == to_trip, ]
#> start_time duration ntransfers stop_id stop_name
#> 1163 08:03:00 00:39:00 2 de:02000:91028::910093 Langobardenweg
#> 1168 08:03:00 00:36:00 4 de:02000:91028::910098 Langobardenweg
#> stop_lon stop_lat
#> 1163 9.966597 53.63475
#> 1168 9.966927 53.63527 Created on 2022-08-16 by the reprex package (v2.0.1) That now lists the correct number of transfers, along with an additional possibility to get there 3 minutes quicker with 4 transfers. Description of bugThe traveltimes algorithm was not counting "implicit" transfers to different services (that is, "trip_id" values) from the same platform ("stop_id" values). The above commit identifies these changes of service, and appropriately increments the aggregated number of transfers. I now have to re-open this issue, because the library (gtfsrouter)
url <- "http://daten.transparenz.hamburg.de/Dataport.HmbTG.ZS.Webservice.GetRessource100/GetRessource100.svc/90a29c65-d9c5-4281-a45a-e12bf19a18fb/Upload__HVV_Rohdaten_GTFS_Fpl_20210903.zip"
file <- "./feeds/HVV.zip"
if (!file.exists (f)) {
download.file(url, file, quiet = FALSE)
}
from_trip <- "S Hamburg Airport"
to_trip <- "Langobardenweg"
start_time_trip <- 8 * 3600
day_trip <- 3 # Tuesday
ham_gtfs <- extract_gtfs(file)
#> ▶ Unzipping GTFS archive✔ Unzipped GTFS archive
#> ▶ Extracting GTFS feed✔ Extracted GTFS feed
#> ▶ Converting stop times to seconds✔ Converted stop times to seconds
#> ▶ Converting transfer times to seconds✔ Converted transfer times to seconds
ham_gtfs <- gtfs_transfer_table (ham_gtfs)
gtfs_route(ham_gtfs, from_trip, to_trip, start_time_trip, day_trip, max_transfers = 4)
#> route_name trip_name stop_name arrival_time
#> 1 S1 Wedel Hamburg Airport (Flughafen) 08:03:00
#> 2 S1 Wedel Ohlsdorf 08:06:00
#> 3 U1 Norderstedt Mitte Ohlsdorf 08:17:00
#> 4 U1 Norderstedt Mitte Klein Borstel 08:18:00
#> 5 U1 Norderstedt Mitte Fuhlsbüttel 08:19:00
#> 6 U1 Norderstedt Mitte Fuhlsbüttel Nord 08:21:00
#> 7 U1 Norderstedt Mitte Langenhorn Markt 08:23:00
#> 8 193 U Garstedt U Langenhorn Markt (Krohnstieg) 08:26:00
#> 9 193 U Garstedt Rittmerskamp 08:27:00
#> 10 193 U Garstedt Samlandweg 08:28:00
#> 11 193 U Garstedt Wrangelkoppel 08:29:00
#> 12 193 U Garstedt Ermlandweg 08:30:00
#> 13 191 Grothwisch Krohnstiegtunnel 08:34:00
#> 14 191 Grothwisch Sperlingsweg 08:36:00
#> 15 191 Grothwisch Moorrand 08:37:00
#> 16 191 Grothwisch Grotkoppelweg 08:38:00
#> 17 191 Grothwisch Langobardenweg 08:39:00
#> 18 <NA> (transfer) S Hamburg Airport 00:44:00
#> departure_time
#> 1 08:03:00
#> 2 08:09:00
#> 3 08:17:00
#> 4 08:18:00
#> 5 08:19:00
#> 6 08:21:00
#> 7 08:23:00
#> 8 08:26:00
#> 9 08:27:00
#> 10 08:28:00
#> 11 08:29:00
#> 12 08:30:00
#> 13 08:34:00
#> 14 08:36:00
#> 15 08:37:00
#> 16 08:38:00
#> 17 08:39:00
#> 18 <NA> That seems to be just a final error with the returned order of the stops along the route. |
Those parameters aren't needed; the solution is to entirely prevent initial transfers
That last commit removes any transfers from being traced from the set of start stations, and so fixes the bug here. Running |
Works as described, thank you! |
@mpadge As I mentioned here, I think I've found a wrong behavior in the
This result still looks correct when running it with the latest ttimes_mintransfer <- gtfs_traveltimes(ham_gtfs, from_trip,
start_time_limits = c(8 * 60 * 60, 9 * 60 * 60),
day = day_trip, max_traveltime = 60 * 60,
minimise_transfers = TRUE)
ttimes_mintransfer[ttimes_mintransfer$stop_name == to_trip, ]
#> start_time duration ntransfers stop_id stop_name stop_lon stop_lat
#> 1353 08:33:00 00:39:00 0 de:02000:91028::910093 Langobardenweg 9.966597 53.63475
#> 1358 08:33:00 00:45:00 1 de:02000:91028::910098 Langobardenweg 9.966927 53.63527 Let me know if you need any more info or anything. Cheers! |
Shall do @jh0ker, thanks! I recently also noticed odd behaviour when calling with |
Hi! I found a bug with how transfers are counted.
I am using the new Sept 2021 - Dec 2021 HVV GTFS found here.
I am using gtfsrouter 0.0.5.042 with R version 4.0.5
When I read this file in
This issue persists even when
gtfs_route()
is run on a timetable and not the gtfs itself.This issue is there in the traveltime table as well
Is this a bug or could this be an issue with the particular GTFS somehow?
The text was updated successfully, but these errors were encountered: