Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

otp_connect

Set up and confirm a connection to an OTP instance.


Description

Defines the parameters required to connect to a router on an OTP instance and, if required, confirms that the instance and router are query-able.

Usage

otp_connect(
  hostname = "localhost",
  router = "default",
  url = NULL,
  port = 8080,
  ssl = FALSE,
  check = TRUE,
  timezone = Sys.timezone()
)

Arguments

hostname

A string, e.g. "ec2-34-217-73-26.us-west-2.compute.amazonaws.com". Optional, default is "localhost".

router

A string, e.g. "UK2018". Optional, default is "default". OTP can support multiple routers see advanced vignette for details.

url

If a non-standard URL structure is used provide a full url, default is NULL

port

A positive integer. Optional, default is 8080.

ssl

Logical, indicates whether to use https. Optional, default is FALSE.

check

Logical. If TRUE connection object is only returned if OTP instance and router are confirmed reachable. Optional, default is TRUE.

timezone

Character, timezone, defaults to local timezone

Details

The default URL structure for the OTP API is: http://<hostname>:<port>/otp/routers/<router> For example: http://localhost:8080/otp/routers/default

Functions construct the URL from the parameters provided in otpconnect objects. However some websites hosting OTP have modified the default URL structure. If this is the case you can use the url parameter to bypass the URL construction and provide a fully formed URL. In this case the hostname, router, port, and ssl are ignored.

Value

Returns an S3 object of class otpconnect. If check is TRUE and the router is not reachable the object is not returned.

Examples

## Not run: 
otpcon <- otp_connect()
otpcon <- otp_connect(
  router = "UK2018",
  ssl = TRUE
)
otpcon <- otp_connect(
  hostname = "ec2.us-west-2.compute.amazonaws.com",
  router = "UK2018",
  port = 8888,
  ssl = TRUE
)
otpcon <- otp_connect(
  url = "https://api.digitransit.fi:443/routing/v1/routers/hsl"
)

## End(Not run)

opentripplanner

Setup and connect to 'OpenTripPlanner'

v0.3.1
GPL-3
Authors
Malcolm Morgan [aut, cre] (<https://orcid.org/0000-0002-9488-9183>), Marcus Young [aut] (<https://orcid.org/0000-0003-4627-1116>), Robin Lovelace [aut] (<https://orcid.org/0000-0001-5679-6536>), Layik Hama [ctb] (<https://orcid.org/0000-0003-1912-4890>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.