View source: R/osrm_partition.R
| osrm_partition | R Documentation |
Run the osrm-partition tool to partition an OSRM graph for the MLD pipeline.
After running, a companion <base>.osrm.partition file must exist to confirm success.
osrm_partition(
input_osrm,
threads = 8L,
verbosity = c("INFO", "NONE", "ERROR", "WARNING", "DEBUG"),
balance = 1.2,
boundary = 0.25,
optimizing_cuts = 10L,
small_component_size = 1000L,
max_cell_sizes = c(128, 4096, 65536, 2097152),
quiet = FALSE,
verbose = FALSE,
spinner = TRUE,
echo_cmd = FALSE
)
input_osrm |
A string. Path to a |
threads |
An integer. Number of threads for extract and partition/contract; default |
verbosity |
A string. Log verbosity for extract/partition/contract
(one of |
balance |
A numeric. Balance for |
boundary |
A numeric. Boundary percentage for |
optimizing_cuts |
An integer. Optimizing cuts for |
small_component_size |
An integer. For extract & partition; default |
max_cell_sizes |
A numeric vector. Max cell sizes for |
quiet |
A logical. Master switch that suppresses package messages and
process output when |
verbose |
A logical. When |
spinner |
A logical. When |
echo_cmd |
A logical. When |
An object of class osrm_job with the following elements:
The path to the partitioned .osrm.partition file.
The directory containing all OSRM files.
The processx::run result object.
if (identical(Sys.getenv("OSRM_EXAMPLES"), "true")) {
install_dir <- osrm_install(
version = "latest",
path_action = "session",
quiet = TRUE
)
# Prepare a small graph then partition it for the MLD pipeline
pbf_path <- system.file("extdata/cur.osm.pbf", package = "osrm.backend")
osrm_dir <- file.path(tempdir(), paste0("osrm-", Sys.getpid()))
dir.create(osrm_dir, recursive = TRUE)
tmp_pbf <- file.path(osrm_dir, "cur.osm.pbf")
file.copy(from = pbf_path, to = tmp_pbf, overwrite = TRUE)
profile <- osrm_find_profile("car.lua")
extract_job <- osrm_extract(
input_osm = tmp_pbf,
profile = profile,
overwrite = TRUE,
threads = 1L
)
partition_job <- osrm_partition(extract_job, threads = 1L, verbose = TRUE)
partition_job$osrm_job_artifact
osrm_uninstall(
dest_dir = install_dir,
clear_path = TRUE,
force = TRUE,
quiet = TRUE
)
unlink(osrm_dir, recursive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.