This R6 class is the foundation for R6 classes ORSDocker
,
ORSJar
and ORSWar
and cannot be initialized.
It defines methods to manage and modify configurations and extracts of
OpenRouteService.
Super class
rors::ORSInstance
-> ORSLocal
Public fields
paths
List of relevant file paths for the ORS setup. Includes the top directory, compose file, config file and extract file.
version
Version of the local ORS backend
config
Information of the configuration file (
ors-config.yml
). The config file holds various options about the ORS instance. This field gives details about:profiles: A named vector of active routing profiles
parsed: Parsed configuration file. When making changes to this obhect, make sure to run
$update()
to apply the changes. For details, refer to the ORS reference.
extract
Information on the extract file. Contains the name and size of the selected extract file.
Methods
Method update()
Updates ORS instance. Use this to apply changes made either in the
file system or to the ors_instance
object itself. This
method is automatically called when using any method of
ors_instance
that changes the ORS setup.
Usage
ORSLocal$update(what = c("fs", "self"))
Arguments
what
[character]
Whether to change the file system with changes in R or update the instance object with changes in the file system. If
what = "self"
, parses the relevant files in the ORS directory and updates theors_instance
object. Ifwhat = "fs"
, updates the compose file and config file based on the changes made to theors_instance
object.
Method report()
Prints a situation report of the ORS instance. Invokes all relevant print methods that summarize the current state of the instance object.
Method set_extract()
Download and set an OpenStreetMap extract for use in ORS. Wrapper for
oe_get()
.
Usage
ORSLocal$set_extract(
place,
provider = "geofabrik",
timeout = NULL,
file = NULL,
do_use = TRUE,
...
)
Arguments
place
[various]
Place name,
sf/sfc/bbox
object or bounding box for which to download an extract file. For details, refer tooe_match()
.provider
[character/NULL]
Extract provider to download extract from. Available providers can be found by running
oe_providers()
. IfNULL
, tries all providers.timeout
[numeric]
Timeout for extract downloads. Defaults to
getOption("timeout")
.file
[character/NULL]
Path to a local OSM extract. Can either be a full path to any OSM file or the filename of an OSM file in the data folder of ORS. If file is specified,
place
andprovider
are ignored.do_use
[logical]
If
TRUE
, enables graph building with the new extract. IfFALSE
, does not change the compose file at all....
Further arguments passed to
oe_get()
.
Method add_profiles()
Add routing profiles to the ORS configuration. ORS only builds routing graphs for active profiles.
Arguments
...
Objects of class
ors_profile
or character strings. If a character string is passed, it is interpreted asors_profile(..., template = TRUE)
.
Method set_endpoints()
Change endpoint-specific configurations. Specifies options that are relevant for entire API endpoints such as isochrones.
Arguments
...
[list/NULL]
Named arguments containing the configuration for the endpoints. Available endpoits are
routing
,isochrones
,matrix
, andsnap
. Refer to application.yml for a list of defaults.
Examples
if (FALSE) { # \dontrun{
ors <- ors_instance(dir = "~", type = "docker")
ors <- ors_instance(dir = "~", type = "jar")
ors <- ors_instance(dir = "~", type = "war")
} # }