Skip to contents

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

Inherited 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 the ors_instance object. If what = "fs", updates the compose file and config file based on the changes made to the ors_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.

Usage

ORSLocal$report()


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 to oe_match().

provider

[character/NULL]

Extract provider to download extract from. Available providers can be found by running oe_providers(). If NULL, 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 and provider are ignored.

do_use

[logical]

If TRUE, enables graph building with the new extract. If FALSE, does not change the compose file at all.

...

Further arguments passed to oe_get().


Method rm_extract()

Removes extract files from the data directory.

Usage

ORSLocal$rm_extract(...)

Arguments

...

File names of extract files in the data directory. All files that exist are removed. Can also be a single vector of file names.


Method add_profiles()

Add routing profiles to the ORS configuration. ORS only builds routing graphs for active profiles.

Usage

ORSLocal$add_profiles(...)

Arguments

...

Objects of class ors_profile or character strings. If a character string is passed, it is interpreted as ors_profile(..., template = TRUE).


Method rm_profiles()

Remove routing profiles from the ORS configuration.

Usage

ORSLocal$rm_profiles(...)

Arguments

...

Names of routing profiles to remove. "default" removes profile defaults. Can also be a single character vector.


Method set_endpoints()

Change endpoint-specific configurations. Specifies options that are relevant for entire API endpoints such as isochrones.

Usage

ORSLocal$set_endpoints(...)

Arguments

...

[list/NULL]

Named arguments containing the configuration for the endpoints. Available endpoits are routing, isochrones, matrix, and snap. Refer to application.yml for a list of defaults.


Method clone()

The objects of this class are cloneable with this method.

Usage

ORSLocal$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
ors <- ors_instance(dir = "~", type = "docker")
ors <- ors_instance(dir = "~", type = "jar")
ors <- ors_instance(dir = "~", type = "war")
} # }