ptv_search: Use a character term to search for routes, stops, and...

View source: R/search.R

ptv_searchR Documentation

Description

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.

Usage

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()
)

Arguments

search_term

Character. Term used to perform search.

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.

include_outlets

Boolean. Optional. Affects search results.

match_stop_by_suburb

Boolean. Optional. Affects search results.

match_route_by_suburb

Boolean. Optional. Affects search results.

match_stop_by_gtfs_stop_id

Boolean. Optional. Affects search results.

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.

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.

Value

The response of the search API call.


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