Skip to content

Commit

Permalink
re-run car directions with geometry
Browse files Browse the repository at this point in the history
using jdk 21 and dev r5r
  • Loading branch information
temospena committed Dec 5, 2023
1 parent bf94144 commit ed1944a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
35 changes: 35 additions & 0 deletions code/test-code/heat-prep_car_GEO.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# same as heat-prep_car.R bur with linestrings from routes

library(dplyr)
library(sf)
options(java.parameters = '-Xmx110G')
library(r5r)
r5r_lts_intermodalityALL = setup_r5(data_path = "r5r/allmodes2/", elevation = "MINETTI") #to create new, delete network.dat in the folder. otherwise just load it


routes_r5r_100jit_car_GEO = detailed_itineraries(
r5r_lts_intermodalityALL,
origins = od_jittered_100filter_OR,
destinations = od_jittered_100filter_DE,
mode = "CAR", #only car
mode_egress = "WALK",
departure_datetime = departure_datetime,
max_trip_duration = 120L, #in minutes
shortest_path = TRUE, #FALSE? fastest or multiple alternatives?
all_to_all = FALSE,
n_threads = Inf,
verbose = FALSE,
progress = TRUE,
drop_geometry = FALSE
# output_dir = "r5r/resultstemp/"
)


routes_r5r_100jit_car_GEO = routes_r5r_100jit_car_GEO %>% mutate(id = as.integer(from_id)) %>%
select(id, total_duration, total_distance, segment, mode, segment_duration, distance, geometry) %>%
left_join(od_jittered_100filter %>% st_drop_geometry(), by="id")

names(routes_r5r_100jit_car_GEO)[7] = "distance"
names(routes_r5r_100jit_car_GEO)[18] = "eucl_distance"

saveRDS(routes_r5r_100jit_car_GEO, "routes_r5r_100jit_car_GEO.Rds")
6 changes: 4 additions & 2 deletions code/test-code/r5r_reprex.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# system.file("jar", package = "r5r")
# tools::R_user_dir("r5r", which = "cache")

r5r::download_r5(force_update = TRUE)
r5r::r5r_sitrep()
tools::R_user_dir("r5r", which = "cache")

# sudo Rscript -e "r5r::download_r5(force_update = TRUE)"

options(java.parameters = '-Xmx32G')
options(java.parameters = '-Xmx120G')
library(r5r)
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- r5r::setup_r5(data_path = data_path)

0 comments on commit ed1944a

Please sign in to comment.