A function that returns details of airports within a user-specified distance of a given airport.

airports_near_airport(input, distance = 100)

Arguments

input

An airport name, IATA code, or ICAO code. Input type will be guessed unless explicitly defined

distance

Distance boundary for nearest airport lookup in kilometres

Value

A tibble of airports that fall within the specified range of input airport

Examples

airports_near_airport("YVR")
#> # A tibble: 26 × 17
#>    `OpenFlights ID` Name                City  IATA  ICAO  Country `Country Code`
#>               <dbl> <chr>               <chr> <chr> <chr> <chr>   <chr>         
#>  1               33 Nanaimo Airport     Nana… "YCD" CYCD  Canada  124           
#>  2               39 Chilliwack Airport  Chil… "YCW" CYCW  Canada  124           
#>  3              104 Pitt Meadows Airpo… Pitt… "\\N" CYPK  Canada  124           
#>  4              156 Vancouver Internat… Vanc… "YVR" CYVR  Canada  124           
#>  5              175 Abbotsford Airport  Abbo… "YXX" CYXX  Canada  124           
#>  6              184 Victoria Internati… Vict… "YYJ" CYYJ  Canada  124           
#>  7             3573 Whidbey Island Nav… Whid… "NUW" KNUW  United… 840           
#>  8             3777 Bellingham Interna… Bell… "BLI" KBLI  United… 840           
#>  9             4106 Victoria Harbour S… Vict… "YWH" CYWH  Canada  124           
#> 10             5493 Texada Gillies Bay… Texa… "YGB" CYGB  Canada  124           
#> # ℹ 16 more rows
#> # ℹ 10 more variables: `Country Code (Alpha-2)` <chr>,
#> #   `Country Code (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>,
#> #   Altitude <dbl>, UTC <chr>, DST <chr>, Timezone <chr>, Type <chr>,
#> #   Source <chr>

# Or with a user specified distance in kilometres
airports_near_airport("YVR", distance = 200)
#> # A tibble: 43 × 17
#>    `OpenFlights ID` Name                City  IATA  ICAO  Country `Country Code`
#>               <dbl> <chr>               <chr> <chr> <chr> <chr>   <chr>         
#>  1               25 Tofino / Long Beac… Tofi… "YAZ" CYAZ  Canada  124           
#>  2               30 Campbell River Air… Camp… "YBL" CYBL  Canada  124           
#>  3               33 Nanaimo Airport     Nana… "YCD" CYCD  Canada  124           
#>  4               39 Chilliwack Airport  Chil… "YCW" CYCW  Canada  124           
#>  5               44 Princeton Airport   Prin… "\\N" CYDC  Canada  124           
#>  6               78 Kamloops Airport    Kaml… "YKA" CYKA  Canada  124           
#>  7              104 Pitt Meadows Airpo… Pitt… "\\N" CYPK  Canada  124           
#>  8              119 Comox Airport       Comox "YQQ" CYQQ  Canada  124           
#>  9              156 Vancouver Internat… Vanc… "YVR" CYVR  Canada  124           
#> 10              175 Abbotsford Airport  Abbo… "YXX" CYXX  Canada  124           
#> # ℹ 33 more rows
#> # ℹ 10 more variables: `Country Code (Alpha-2)` <chr>,
#> #   `Country Code (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>,
#> #   Altitude <dbl>, UTC <chr>, DST <chr>, Timezone <chr>, Type <chr>,
#> #   Source <chr>