-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3a1695
commit a6edb32
Showing
3 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: r5r | ||
Title: Rapid Realistic Routing with 'R5' | ||
Version: 1.1.0.9000 | ||
Version: 1.1.0.9001 | ||
Authors@R: c( | ||
person("Marcus", "Saraiva", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0001-6218-2338")), | ||
|
@@ -32,7 +32,7 @@ Description: Rapid realistic routing on multimodal transport networks | |
independent update process. Hence, users should confirm the R5 version | ||
implied by the Conveyal user manual (see | ||
<https://docs.conveyal.com/changelog>) corresponds with the R5 version | ||
that r5r depends on. This version of r5r depends on R5 v7.0. | ||
that r5r depends on. This version of r5r depends on R5 v7.1. | ||
License: MIT + file LICENSE | ||
URL: https://github.com/ipeaGIT/r5r | ||
BugReports: https://github.com/ipeaGIT/r5r/issues | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
tictoc::tic() | ||
|
||
options(java.parameters = "-Xmx10G") | ||
|
||
|
||
library(r5r) | ||
|
||
# build transport network | ||
data_path <- system.file("extdata/poa", package = "r5r") | ||
r5r_core <- setup_r5(data_path) | ||
|
||
# load origin/destination points | ||
points <- read.csv(file.path(data_path, "poa_hexgrid.csv")) | ||
|
||
departure_datetime <- as.POSIXct( | ||
"13-05-2019 14:00:00", | ||
format = "%d-%m-%Y %H:%M:%S" | ||
) | ||
|
||
ttm <- travel_time_matrix( | ||
r5r_core, | ||
origins = points, | ||
destinations = points, | ||
mode = c("WALK", "TRANSIT"), | ||
departure_datetime = departure_datetime, | ||
max_trip_duration = 60 | ||
) | ||
head(ttm) | ||
|
||
# using a larger time window | ||
ttm <- travel_time_matrix( | ||
r5r_core, | ||
origins = points, | ||
destinations = points, | ||
mode = c("WALK", "TRANSIT"), | ||
departure_datetime = departure_datetime, | ||
time_window = 30, | ||
max_trip_duration = 60 | ||
) | ||
head(ttm) | ||
|
||
# selecting different percentiles | ||
ttm <- travel_time_matrix( | ||
r5r_core, | ||
origins = points, | ||
destinations = points, | ||
mode = c("WALK", "TRANSIT"), | ||
departure_datetime = departure_datetime, | ||
time_window = 30, | ||
percentiles = c(25, 50, 75), | ||
max_trip_duration = 60 | ||
) | ||
head(ttm) | ||
|
||
# use a fare structure and set a max fare to take monetary constraints into | ||
# account | ||
fare_structure <- read_fare_structure( | ||
file.path(data_path, "fares/fares_poa.zip") | ||
) | ||
ttm <- travel_time_matrix( | ||
r5r_core, | ||
origins = points, | ||
destinations = points, | ||
mode = c("WALK", "TRANSIT"), | ||
departure_datetime = departure_datetime, | ||
fare_structure = fare_structure, | ||
max_fare = 5, | ||
max_trip_duration = 60, | ||
) | ||
head(ttm) | ||
|
||
|
||
tictoc::toc() | ||
|
||
# 7.1 = 16.17 segundos | ||
# 7.0 = 14.84 segundos | ||
|
||
|
||
# 7.1 = 424.78 segundos | ||
# 7.0 = 382.08 segundos | ||
|