Title: | Helper Functions to Download and Run Osmosis |
---|---|
Description: | Allows one to download and run Osmosis from R. Osmosis is a command line application for processing OpenStreetMap data which consists of several different pluggable components that can be chained to perform large operations. The package currently does not aim to offer functions that covers the entirety of Osmosis' API, and instead offers limited support to running Osmosis through a helper function. |
Authors: | Daniel Herszenhut [aut, cre] |
Maintainer: | Daniel Herszenhut <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-10-25 04:02:03 UTC |
Source: | https://github.com/dhersz/rosmosis |
Downloads Osmosis, a command-line application for processing OpenStreetMap data.
download_osmosis(version = "0.48.3", force = FALSE, quiet = TRUE)
download_osmosis(version = "0.48.3", force = FALSE, quiet = TRUE)
version |
A string. The version of Osmosis to be downloaded. Defaults to
|
force |
A logical. Whether to overwrite previously downloaded and cached
Osmosis. Defaults to |
quiet |
A logical. Whether to hide informative messages or not. Defaults
to |
Invisibly returns the path to Osmosis.
download_osmosis()
download_osmosis()
Returns the path to previously downloaded and cached Osmosis. If it has not
been downloaded yet, downloads it using download_osmosis()
.
osmosis_path(version = "0.48.3", force = FALSE, quiet = TRUE)
osmosis_path(version = "0.48.3", force = FALSE, quiet = TRUE)
version |
A string. The version of Osmosis whose path should be
returned. Defaults to |
force |
A logical. Passed to |
quiet |
A logical. Passed to |
A string, the path to Osmosis.
osmosis_path()
osmosis_path()
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)
run_osmosis(osmosis_path, command, echo = TRUE, spinner = TRUE)
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 |
spinner |
A logical. Whether to show a reassuring spinner while the
process is running. Defaults to |
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.
cur_osm <- system.file("extdata/cur.osm.pbf", package = "rosmosis") fs::file_size(cur_osm) # 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)
cur_osm <- system.file("extdata/cur.osm.pbf", package = "rosmosis") fs::file_size(cur_osm) # 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)