search_routes {ptvapi} | R Documentation |
Search for routes using text
Description
This function will search routes in which the search term can be found in
one of many fields, such as route_id
, route_gtfs_id
, or route_name
.
The search is case-insensitive. Unlike search_stops
and
search_outlets
, this function supports searching for numerics,
and has no minimum character requirement for search_term
.
Usage
search_routes(
search_term,
latitude = NULL,
longitude = NULL,
max_distance = NULL,
route_types = NULL,
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
|
user_id |
Integer or character. A user ID or devid provided by Public
Transport Victoria. Refer to |
api_key |
Character. An API key, with dashes, provided by Public
Transport Victoria. Refer to |
Value
A tibble of routes, with the following columns:
-
route_id
-
route_gtfs_id
-
route_name
-
route_type
-
route_type_description
-
route_number
-
geopath
-
service_status
-
service_status_timestamp
Examples
## Not run:
search_routes("Pakenham")
search_routes("Pakenham", route_types = c("Train", "Tram"))
search_routes("Pakenham", route_types = 1)
search_routes(
"Pakenham",
latitude = -38.077877,
longitude = 145.484751
)
search_routes(
"Pakenham",
latitude = -38.077877,
longitude = 145.484751,
max_distance = 100
)
## End(Not run)