get_location_xml {bodsr}R Documentation

Return XML vehicle location data from the 'BODS' API

Description

Return XML vehicle location data from the 'BODS' API

Usage

get_location_xml(
  api_key = Sys.getenv("BODS_KEY"),
  bounding_box = NULL,
  noc = NULL,
  vehicle_ref = NULL,
  line_ref = NULL,
  producer_ref = NULL,
  origin_ref = NULL,
  destination_ref = 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.

noc

string or vector of strings. Limit results to fares data sets for specified National Operator Codes. A full lookup of NOC to bus operator names can be seen using noc_lookup(). Defaults to NULL.

vehicle_ref

string. Limit results to bus location data with the specified vehicle_ref. This is a unique reference for the vehicle that is consistent and is generated by the vehicle equipment. Defaults to NULL.

line_ref

string. Limit results to bus location data with the specified line_ref. Defaults to NULL.

producer_ref

string. Limit results to bus location data with the specified producer_ref. Defaults to NULL.

origin_ref

string. Limit results to bus location data with the specified origin reference. Accepts any National Public Transport Access Nodes (NaPTAN) value, which can be found the NaPTAN access nodes dataset. Defaults to NULL.

destination_ref

string. Limit results to bus location data with the specified destination reference. Accepts any National Public Transport Access Nodes (NaPTAN) value, which can be found the NaPTAN access nodes dataset. Defaults to NULL.

Value

Returns bus location data in XML SIRI-VM 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 unfiltered data from XML API
get_location_xml()

#Return data for vehicle reference "BUSC" only
get_location_xml(vehicle_ref = "BUSC")

#Return data for specified origin
get_location_xml(origin_ref = "21024515")


## End(Not run)

[Package bodsr version 0.1.0 Index]