stops_nearby: Stops near a given location

View source: R/stops.R

stops_nearbyR Documentation

Stops near a given location

Description

Stops near a given location

Usage

stops_nearby(
  latitude,
  longitude,
  max_distance = NULL,
  route_types = NULL,
  user_id = determine_user_id(),
  api_key = determine_api_key()
)

Arguments

latitude

Numeric. Latitude in decimal degrees. For example, Flinders Street Station is at approximately -37.8183 latitude.

longitude

Numeric. Longitude in decimal degrees. For example, Flinders Street Station is at approximately 144.9671 longitude.

max_distance

Integer. Optionally filter by maximum distance from the given location, in metres.

route_types

Integer or character vector. Optionally filter by a vector of route types. A route type can be provided either as a non-negative integer code, or as a character: "Tram", "Train", "Bus", "Vline" or "Night Bus". Character inputs are not case-sensitive. Use the route_types function to extract a vector of all route types.

user_id

Integer or character. A user ID or devid provided by Public Transport Victoria. Refer to ?ptvapi for more details.

api_key

Character. An API key, with dashes, provided by Public Transport Victoria. Refer to ?ptvapi for more details.

Value

A tibble with the following columns:

  • stop_id

  • stop_name

  • stop_suburb

  • route_type

  • route_type_description

  • stop_sequence

  • stop_latitude

  • stop_longitude

  • disruption_ids

Examples

## Not run: 
stops_nearby(latitude = -37.8183, longitude = 144.9671)
stops_nearby(latitude = -37.8183, longitude = 144.9671, max_distance = 1000)
stops_nearby(
  latitude = -37.8183,
  longitude = 144.9671,
  route_types = c("Train", "Tram")
)

stops_nearby(
  latitude = -37.8183,
  longitude = 144.9671,
  route_types = 0
 )

## End(Not run)

ptvapi documentation built on May 29, 2024, 4:48 a.m.