ipeaGIT / r5r

https://ipeagit.github.io/r5r/
Other
177 stars 26 forks source link

Parameter max_walking_distance only applies to public transport trips #62

Closed mvpsaraiva closed 3 years ago

mvpsaraiva commented 3 years ago

R5's maxWalkTime parameter, that is set in R5R via max_walking_distance, only applies to walking segments of trips with public transportation options. Hence, for direct trips, R5 returns a walking option if one is available within the time set by max_trip_duration. Example:

library("r5r")
library("ggplot2")

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

# Load points of interest
points <- read.csv(system.file("extdata/poa_points_of_interest.csv", package = "r5r"))

# Configuring trip
origin <- points[10,] # Farrapos train station
destination <- points[12,] # Praia de Belas shopping mall

trip_date_time <- lubridate::as_datetime("2019-03-20 14:00:00")

max_walk_distance = 0.8
max_trip_duration = 120L

paths_df <- detailed_itineraries(r5r_core = r5r_core,
                                 origins = origin, destinations = destination,
                                 departure_datetime = trip_date_time,
                                 max_walk_dist = max_walk_distance,
                                 max_trip_duration = max_trip_duration,
                                 mode = c("WALK", "BUS"),
                                 shortest_path = FALSE, verbose = FALSE)

paths_df %>%
  ggplot() +
  geom_sf(aes(colour=mode)) +
  facet_wrap(~option)

I'm leaving this issue here so we can discuss if this is an expected/desirable outcome.

dhersz commented 3 years ago

In my opinion no walking segment distance should be higher than max_walking_distance, no matter if it's a direct trip or not. What do you think?

rafapereirabr commented 3 years ago

I agree with Daniel that the parameter max_walking_distance set by the user should apply to all walking trips, including direct and access/egress. @mvpsaraiva , is there a way to force this limit in direct walking trips as well?

mvpsaraiva commented 3 years ago

Ok. R5 will calculate the walking route anyways, but I can drop the result if it's longer than max_walking_distance. I'll do this in the next version of the JAR.

mvpsaraiva commented 3 years ago

Done in cc75cecb1b7b86319e8fe08fdfd3ee95874b35d9