find_location: Get location ID depending on a query term.

Description Usage Arguments Examples

View source: R/find-location.R

Description

Get location ID depending on a query term using the [Kiwi API](https://docs.kiwi.com/).

Usage

1
find_location(term, location_types = NA, locale = "en-US")

Arguments

term

searched term (for suggestions). This parameter expects a full IATA code. If IATA code is not given, the search will go through other available fields: 'name' or 'code' of the location. It also depends on the 'location_types' specified eg. airport, city, country. The search that is used behind the scenes is elasticsearch. It returns data based on relevancy and many other factors.

location_types

list of desired location output, accepted values: station, airport, bus_station, city, autonomous_territory, subdivision, country, region, continent.

locale

desired locale output - this is the language of the results. Should any other locale be used other than the specified locales.

Examples

1
2
3
4
5
cba_locs <- find_location("Cordoba", location_types = c("city", "airport"))
# show some info of the found locations
lapply(cba_locs, function(act_loc) {
  c(act_loc$name, act_loc$country$name)
})

rflights documentation built on Sept. 19, 2019, 1:02 a.m.