get_location_gtfs {bodsr}R Documentation

Return GTFS-RT location data from the 'BODS' API

Description

Return GTFS-RT location data from the 'BODS' API

Usage

get_location_gtfs(
  api_key = Sys.getenv("BODS_KEY"),
  bounding_box = NULL,
  route_id = NULL,
  start_time_after = NULL,
  start_time_before = NULL
)

Arguments

api_key

API key for the 'BODS' dataset passed as a string. Can be obtained from the 'BODS' API login

bounding_box

vector of four numerics. Limit results to location data for vehicles within the rectangular boundingBox you set using co-ordinates [minLatitude, maxLatitude, minLongitude, maxLongitude]. Defaults to NULL.

route_id

string or vector of strings. Limit results to bus location data with the specified routeId. Defaults to NULL.

start_time_after

integer. Limit results to bus location data with a start time after the specified Unix timestamp. Defaults to NULL.

start_time_before

integer. Limit results to bus location data with a start time before the specified Unix timestamp. Defaults to NULL.

Value

Returns bus location data in GTFS-RT format. More detail on this format can be found the 'BODS' data formats documentation

Examples


## Not run: 
#Before running these examples, ensure you have an API key saved


#Return data for specified route ID
get_location_gtfs(route_id = "45")

#Return data within a specified bounding box
get_location_gtfs(bounding_box = c(51.401, 51.509, 0.01, 0.201))


## End(Not run)

[Package bodsr version 0.1.0 Index]