Skip to content
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

Different times, same results #102

Closed
mortewle opened this issue Aug 27, 2020 · 3 comments
Closed

Different times, same results #102

mortewle opened this issue Aug 27, 2020 · 3 comments

Comments

@mortewle
Copy link

I notice that the results from r5r::travel_time_matrix are the same for all times that I choose. I use the line specified in the vignette (with different times):

departure_datetime = lubridate::as_datetime("2019-03-20 14:00:00")

Is this supposed to happen?

@mvpsaraiva
Copy link
Collaborator

Hi @mortewle. Thanks for trying our package.
If you are using our sample data, please have in mind that the GTFS provided contains just a few routes. Hence, when calculating a travel time matrix, many travel times will come from walking trips, which should not be affected by the departure time.

I did a small test and, if you look closely, you can see that many travel times are different. Can you try the code below and report the results back, please?

options(java.parameters = "-Xmx4G")

library("r5r")
library("dplyr")

# Start R5R core
r5r_core <- setup_r5(system.file("extdata", package = "r5r"), verbose = FALSE)

# Load points
points_hex <- read.csv(system.file("extdata/poa_hexgrid.csv", package = "r5r"))


# Testing trip date and time
max_walk_distance = 800L
max_trip_duration = 120L

# 8 am
trip_date_time <- lubridate::as_datetime("2019-03-22 08:27:00")
ttm_8am <- travel_time_matrix(r5r_core, points_hex, points_hex, 
                              mode = c("WALK", "BUS"), 
                              departure_datetime = trip_date_time, max_walk_dist = max_walk_distance,
                              max_trip_duration = max_trip_duration, verbose = FALSE)

# 11 am
trip_date_time <- lubridate::as_datetime("2019-03-22 11:13:00")
ttm_11am <- travel_time_matrix(r5r_core, points_hex, points_hex, 
                              mode = c("WALK", "BUS"), 
                              departure_datetime = trip_date_time, max_walk_dist = max_walk_distance,
                              max_trip_duration = max_trip_duration, verbose = FALSE)

# Checking results
full_join(ttm_8am, ttm_11am, by=c("fromId", "toId")) %>% 
  filter(travel_time.x != travel_time.y) %>% 
  View()

full_join(ttm_8am, ttm_11am, by=c("fromId", "toId")) %>% 
  filter(travel_time.x == travel_time.y) %>% 
  View()

@mortewle
Copy link
Author

Hi. Looking closer at my results, it seems like all the trips I checked earlier were walking only or had the exact same waiting time for the times I chose, because now I see some divergence. It works with the code you provided as well. Thank you!

Great package by the way!

@mvpsaraiva
Copy link
Collaborator

Thanks @mortewle!
All feedback is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants