There's only one search API call, and it covers stops, routes, and outlets. This function will return the response of this generic search. It is expected that other functions will take on of these three categories of search results, parse them, and return them to the user as a tibble.
ptv_search(
search_term,
latitude = NULL,
longitude = NULL,
max_distance = NULL,
route_types = NULL,
include_outlets = FALSE,
match_stop_by_suburb = FALSE,
match_route_by_suburb = FALSE,
match_stop_by_gtfs_stop_id = FALSE,
user_id = determine_user_id(),
api_key = determine_api_key()
)
The response of the search
API call.
Character. Term used to perform search.
Numeric. Latitude in decimal degrees. For example, Flinders Street Station is at approximately -37.8183 latitude.
Numeric. Longitude in decimal degrees. For example, Flinders Street Station is at approximately 144.9671 longitude.
Integer. Optionally filter by maximum distance from the given location, in metres.
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.
Boolean. Optional. Affects search results.
Boolean. Optional. Affects search results.
Boolean. Optional. Affects search results.
Boolean. Optional. Affects search results.
Integer or character. A user ID or devid provided by Public
Transport Victoria. Refer to ?ptvapi
for more details.
Character. An API key, with dashes, provided by Public
Transport Victoria. Refer to ?ptvapi
for more details.
If the search term is numeric and/or less than 3 characters, the API will return only routes. By default, as little matching is done as possible, and as little as possible is returned. We rely on functions that call on this function to specify what is needed.