Runs Osmosis, given the path to the application and the commands that should be sent to the command-line tool.

run_osmosis(osmosis_path, command, echo = TRUE, spinner = TRUE)

Arguments

osmosis_path

A string. The path to Osmosis.

command

A string. The command to run.

echo

A logical. Whether to print the standard output and error to the screen. Defaults to TRUE.

spinner

A logical. Whether to show a reassuring spinner while the process is running. Defaults to TRUE.

Value

Invisibly returns a list containing the exit status of the Osmosis process, the standard output of the command, the standard error of the command and whether the process was killed due to a timeout.

Examples

cur_osm <- system.file("extdata/cur.osm.pbf", package = "rosmosis")

fs::file_size(cur_osm)
#> 513K

# cropping the pbf using a bounding box

output_path <- tempfile("cropped_cur", fileext = ".osm.pbf")

osmosis_command <- paste0(
  "--read-pbf ", cur_osm, " ",
  "--bounding-box ",
  "top=-25.4290 left=-49.2792 bottom=-25.4394 right=-49.2629 ",
  "completeWays=yes ",
  "--write-pbf ", output_path
)

run_osmosis(osmosis_path(), osmosis_command, echo = FALSE, spinner = FALSE)
fs::file_size(output_path)
#> 210K