Skip to content

Transfers counted incorrectly #88

Open
@szaboildi

Description

@szaboildi

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

library(gtfsrouter)
library(data.table)

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 <- tempfile()
download.file(url, file, quiet = TRUE)

from_trip <- "S Hamburg Airport"
to_trip <- "Langobardenweg"
start_time_trip <- c(8, 0)
day_trip <- 3 # Tuesday

ham_gtfs <- extract_gtfs(file)
# v Unzipped GTFS archive  
# v Extracted GTFS feed 
# v Converted stop times to seconds 
# v Converted transfer times to seconds

gtfs_route(ham_gtfs, from_trip, to_trip, start_time_trip, day_trip, max_transfers = 0)
#    route_name                      trip_name                      stop_name arrival_time departure_time
# 1         292 Lufthansa-Basis (Haupteingang)              S Hamburg Airport     08:03:00       08:03:00
# 2         292 Lufthansa-Basis (Haupteingang)                Zeppelinstraße     08:05:00       08:05:00
# 3         292 Lufthansa-Basis (Haupteingang)                Röntgenstraße     08:06:00       08:06:00
# 4          23               U Niendorf Markt Lufthansa-Basis (Haupteingang)     08:12:00       08:12:00
# 5          23               U Niendorf Markt                   Paeplowstieg     08:14:00       08:14:00
# 6          23               U Niendorf Markt             Am Licentiatenberg     08:15:00       08:15:00
# 7          23               U Niendorf Markt                     Spreenende     08:17:00       08:17:00
# 8          23               U Niendorf Markt                    Warnckesweg     08:19:00       08:19:00
# 9          23               U Niendorf Markt             Stavenhagenstraße     08:20:00       08:20:00
# 10         23               U Niendorf Markt                      Bekstück     08:21:00       08:21:00
# 11         23               U Niendorf Markt             Niendorfer Straße     08:22:00       08:22:00
# 12         23               U Niendorf Markt               Vogt-Cordes-Damm     08:24:00       08:24:00
# 13        191               Krohnstiegtunnel               U Niendorf Markt     08:35:00       08:35:00
# 14        191               Krohnstiegtunnel               U Niendorf Markt     08:36:00       08:36:00
# 15        191               Krohnstiegtunnel             Fuhlsbütteler Weg     08:38:00       08:38:00
# 16        191               Krohnstiegtunnel                   Helvetierweg     08:39:00       08:39:00
# 17        191               Krohnstiegtunnel                     Krähenweg     08:40:00       08:40:00
# 18        191               Krohnstiegtunnel                 Langobardenweg     08:42:00       08:42:00

This issue persists even when gtfs_route() is run on a timetable and not the gtfs itself.

ham_ttable <- gtfs_timetable(ham_gtfs, day)
gtfs_route(ham_ttable , from_trip, to_trip, start_time_trip, day_trip, max_transfers = 0)

#    route_name                      trip_name                      stop_name arrival_time departure_time
# 1         292 Lufthansa-Basis (Haupteingang)              S Hamburg Airport     08:03:00       08:03:00
# 2         292 Lufthansa-Basis (Haupteingang)                Zeppelinstraße     08:05:00       08:05:00
# 3         292 Lufthansa-Basis (Haupteingang)                Röntgenstraße     08:06:00       08:06:00
# 4          23               U Niendorf Markt Lufthansa-Basis (Haupteingang)     08:12:00       08:12:00
# 5          23               U Niendorf Markt                   Paeplowstieg     08:14:00       08:14:00
# 6          23               U Niendorf Markt             Am Licentiatenberg     08:15:00       08:15:00
# 7          23               U Niendorf Markt                     Spreenende     08:17:00       08:17:00
# 8          23               U Niendorf Markt                    Warnckesweg     08:19:00       08:19:00
# 9          23               U Niendorf Markt             Stavenhagenstraße     08:20:00       08:20:00
# 10         23               U Niendorf Markt                      Bekstück     08:21:00       08:21:00
# 11         23               U Niendorf Markt             Niendorfer Straße     08:22:00       08:22:00
# 12         23               U Niendorf Markt               Vogt-Cordes-Damm     08:24:00       08:24:00
# 13        191               Krohnstiegtunnel               U Niendorf Markt     08:35:00       08:35:00
# 14        191               Krohnstiegtunnel               U Niendorf Markt     08:36:00       08:36:00
# 15        191               Krohnstiegtunnel             Fuhlsbütteler Weg     08:38:00       08:38:00
# 16        191               Krohnstiegtunnel                   Helvetierweg     08:39:00       08:39:00
# 17        191               Krohnstiegtunnel                     Krähenweg     08:40:00       08:40:00
# 18        191               Krohnstiegtunnel                 Langobardenweg     08:42:00       08:42:00

This issue is there in the traveltime table as well

ttimes <- gtfs_traveltimes(ham_gtfs, from_trip,
                           start_time_limits = c(8 * 60 * 60, 9 * 60 * 60), 
                           day = day, max_traveltime = 60 * 60, max)
ttimes[ttimes$stop_name == "Langobardenweg" & ttimes$ntransfers == 0,]
#      start_time duration ntransfers                stop_id      stop_name stop_lon stop_lat
# 1317   08:03:00 00:39:00          0 de:02000:91028::910093 Langobardenweg 9.966597 53.63475

Is this a bug or could this be an issue with the particular GTFS somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions