Repository navigation
Closed
Labels
Description
Deleting GTFS and Elevation data when building the r5r_core affects the results from detailed_itineraries and ttm.
Also the routing times between detailed_itiniraries and ttm don't match. I am not sure if this is known.
I originally thought this was due to McRaptorSuboptimalPathProfileRouter but it also occurs with ttm just the difference is less noticeable.
Repex with one point:
devtools::load_all('.')
# build regular network
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path, overwrite = T)
points <- read.csv(file.path(data_path, "poa_points_of_interest.csv"))
departure_datetime <- as.POSIXct(
"13-05-2019 14:00:00",
format = "%d-%m-%Y %H:%M:%S"
)
# travel times before modifications
det <- detailed_itineraries(
r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60
)
print(det$segment_duration)
# 22.1
ttm <- travel_time_matrix(r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60)
print(ttm$travel_time_p50)
# 18
delete poa_eptc.zip
r5r_core <- setup_r5(data_path, overwrite = T)
det2 <- detailed_itineraries(
r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60
)
print(det2$segment_duration)
# 21.3
ttm2 <- travel_time_matrix(r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60)
print(ttm2$travel_time_p50)
# 18
delete poa_elevation.tif
r5r_core <- setup_r5(data_path, overwrite = T)
det3 <- detailed_itineraries(
r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60
)
print(det3$segment_duration)
# 20.6
ttm3 <- travel_time_matrix(r5r_core,
origins = points[10,],
destinations = points[12,],
mode = c("CAR"),
departure_datetime = departure_datetime,
max_trip_duration = 60)
print(ttm3$travel_time_p50)
# 17
You can also run it with the full origin-destination pairs and then use the code below to see that there are differences in ttm if you remove gtfs data.
library(dplyr)
diff_a <- anti_join(ttm2, ttm1)
diff_b <- anti_join(ttm1, ttm2)
# View differences
View(diff_a)
View(diff_b)
Activity
rafapereirabr commentedon Jun 21, 2025
Hi @BardyBard . We know detailed_itineraries and ttm return slightly different results. This is because they use different routing algorithms underneath, so this is expected.
I was able to reproduce your results. I'm surprised that the presence of a GTFS feed affects travel times by car. I'm also a bit surprised that travel times by car are also affected by by elevation data and the impedance function of choice. I think we should open an issue over at R5 to report this. I'm not sure this is actually a bug or some expected behavior that has not been documented.
[-]GTFS and Elevation data affects carspeeds of detailed_itineraries[/-][+]GTFS and Elevation data affects carspeeds[/+]rafapereirabr commentedon Jun 26, 2025
our friends at R5 have confirmed this a bug upstream and which should be closed sometime soon.
ansoncfit commentedon Nov 18, 2025
This was addressed in conveyal/r5#972
rafapereirabr commentedon Nov 18, 2025
thanks for the heads up, @ansoncfit ! this is much appreciated !