run_server: Start local OSRM server

Description Usage Arguments Details Value Examples

View source: R/server.R

Description

run_server() starts your local OSRM server by using a shell command (depending on your OS). A local (pre-built) version of the OSRM-engine must be on your device. (https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM).

Usage

1
run_server(map_name, osrm_path = Sys.getenv("OSRM_PATH"))

Arguments

map_name

A character (name of your pre-built map - e.g. "switzerland-latest.osrm")

osrm_path

A string pointing to your local OSRM installation. Default is the environment variable "OSRM_PATH".

Details

To start the server, it is necessary to know its location. If it was installed in C:/OSRM_APIx, it is easiest to set an environment variable which points to the folder via Sys.setenv(). Note: You need to set the variable in each session.

Value

error_code A character

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
Sys.setenv("OSRM_PATH"="C:/OSRM_API4")
osrmr::run_server("switzerland-latest.osrm")
# 0
Sys.setenv("OSRM_PATH"="C:/OSRM_API5")
osrmr::run_server("switzerland-latest.osrm")
# 0
Sys.unsetenv("OSRM_PATH")
## End(Not run)

osrmr documentation built on May 31, 2021, 5:07 p.m.