max_trip_duration should be limited by cutoffs
Closed this issue · 1 comments
rafapereirabr commented
In the accessibility function, max_trip_duration is set to 120
(minutes) by default. So R5 will search routes to really further away places. However, I understand that when a user sets cutoffs = 30
, the max_trip_duration should automatically be affected. It seems like this is not happening.
obs. having a max_trip_duration
longer than cutoffs
does NOT affect accessibility estimates, but it does affect computation time.
rafapereirabr commented
The solution would be to add this line of code:
# cap trip duration with cutoffs
if(!is.null(cutoffs)){
max_trip_duration <- ifelse(max_trip_duration > max(cutoffs), max(cutoffs), max_trip_duration)
if(max_trip_duration < max(cutoffs)){stop("'max_trip_duration' cannot be shorter than 'max(cutoffs)'")}
}
before the accessibility()
function runs:
max_walk_time <- assign_max_street_time(
max_walk_time,
walk_speed,
max_trip_duration,
"walk"
)
max_bike_time <- assign_max_street_time(
max_bike_time,
bike_speed,
max_trip_duration,
"bike"
)
max_car_time <- assign_max_street_time(
max_car_time,
8, # 8 km/h, R5's default.
max_trip_duration,
"car"
)
max_trip_duration <- assign_max_trip_duration(
max_trip_duration,
mode_list,
max_walk_time,
max_bike_time
)