Title: | Convenience Tools for Working with Airport Data |
---|---|
Description: | Retrieves open source airport data and provides tools to look up information, translate names into codes and vice-verse, as well as some basic calculation functions for measuring distances. Data is licensed under the ODC Open Database License (ODbL). |
Authors: | Dmitry Shkolnik [cre] |
Maintainer: | Dmitry Shkolnik <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.4 |
Built: | 2024-11-14 03:43:31 UTC |
Source: | https://github.com/dshkol/airportr |
Return all airport details given an input IATA code, ICAO code, or airport name.
airport_detail(input, input_type)
airport_detail(input, input_type)
input |
An airport name, IATA code, or ICAO code. Input type will be guessed unless explicitly defined |
input_type |
One of "name", "IATA", or "ICAO". Function will attempt to guess type if not supplied |
A 1x14 tibble with airport details
airport_detail("YVR") airport_detail("London Heathrow Airport")
airport_detail("YVR") airport_detail("London Heathrow Airport")
A function that calculates distances between pairs of airport codes. Distances are calculated using the Haversine formula which assumes a spherical earth. Distances are returned in kilometres.
airport_distance(airport1, airport2)
airport_distance(airport1, airport2)
airport1 |
Takes a three-letter IATA code corresponding to an airport |
airport2 |
As above |
The great circle distance in kilometres between the two airports
airport_distance("YVR","YYZ")
airport_distance("YVR","YYZ")
Returns airport location in longitude and latitude coordinates given an input IATA code, ICAO code, or airport name.
airport_location(input, input_type)
airport_location(input, input_type)
input |
An airport name, IATA code, or ICAO code. Input type will be guessed unless #' explicitly defined |
input_type |
One of "name", "IATA", or "ICAO". Function will attempt to guess type if not supplied |
List of longitude and latitude coordinates
airport_location("YVR","IATA") #' airport_location("Vancouver International Airport","name")
airport_location("YVR","IATA") #' airport_location("Vancouver International Airport","name")
Return city name, airport name, IATA code, or IACO code given an input IATA code, ICAO code, or airport name.
airport_lookup(input, input_type = "IATA", output_type = "name")
airport_lookup(input, input_type = "IATA", output_type = "name")
input |
An airport name, IATA code, or ICAO code. Input type will be guessed unless #' explicitly defined |
input_type |
One of "name", "IATA", or "ICAO". Function will attempt to guess type if not supplied |
output_type |
One of "name", "city", "IATA", or "ICAO". Defaults to "name" if otherwise not specified |
The appropriate city, airport name, IATA code, or ICAO code for that airport
airport_lookup("CYVR") airport_lookup("YVR", output_type = "city") airport_lookup("Vancouver International Airport", input_type="name",output_type = "IATA") airport_lookup("YVR",input_type = "IATA", output_type = "city") # Produces a list of similar named airports airport_lookup("Vancoover","name","city")
airport_lookup("CYVR") airport_lookup("YVR", output_type = "city") airport_lookup("Vancouver International Airport", input_type="name",output_type = "IATA") airport_lookup("YVR",input_type = "IATA", output_type = "city") # Produces a list of similar named airports airport_lookup("Vancoover","name","city")
A dataset containing names, codes, locations, altitude, and timezones for airports
airports
airports
A data frame with 7698 rows and 14 variables:
OpenFlights database ID
Airport name, sometimes contains name of the city
Name of city served by airport
3-letter IATA code
4-letter ICAO code
Country name as in OpenFlights database. Note that country names may not be ISO 3166-1 standard.
ISO 3166-1 numeric country code
Name of city served by airport
Name of country where airport is located
Latitude in decimal degrees
Longitude in decimal degrees
Altitude in feet
Hours offset from UTC
Daylight savings time. One of E (Europe), A (US/Canada), S (South America), O (Australia), Z (New Zealand), N (None) or U (Unknown)
Timezone in Olson format
Type of airport
Source of data. Airport data generally sourced from OurAirports
https://openflights.org/data.html
A function that returns details of all airports within a user-specified distance of an input coordinate location. Takes as input a longitude and latitude argument.
airports_around(lat, lon, distance = 100)
airports_around(lat, lon, distance = 100)
lat |
Latitude in decimal degrees |
lon |
Longitude in decimal degrees |
distance |
Distance boundary for nearest airport lookup in kilometres |
A tibble of airports that fall within the specified range of specified location
airports_around(-123,49.2) # Or with a user specified distance in kilometres airports_around(-123, 49.2, distance = 200)
airports_around(-123,49.2) # Or with a user specified distance in kilometres airports_around(-123, 49.2, distance = 200)
A function that returns details of airports within a user-specified distance of a given airport.
airports_near_airport(input, distance = 100)
airports_near_airport(input, distance = 100)
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 |
A tibble of airports that fall within the specified range of input airport
airports_near_airport("YVR") # Or with a user specified distance in kilometres airports_near_airport("YVR", distance = 200)
airports_near_airport("YVR") # Or with a user specified distance in kilometres airports_near_airport("YVR", distance = 200)
This function takes a city normal city name as an input argument and returns all airports associated with that city. Airports are typically associated with their local metropolitan area but some exceptions may be present in the data. If there are no matching results in the data for the city argument, a list of closely named alternatives will be suggested with a warning.
city_airports(city, country)
city_airports(city, country)
city |
A city name. If no exact match will attempt to prompt user with suggested alternatives |
country |
(Optional) A country name or ISO country code in either numeric, alpha-2, or alpha 3 format. Case insensitive. |
A Nx17
tibble with airport details where n
is the number of airports serving that city
city_airports("Vancouver") city_airports("London") city_airports("London","Canada") city_airports("London","CA") city_airports("London","CAN") city_airports("London","124")
city_airports("Vancouver") city_airports("London") city_airports("London","Canada") city_airports("London","CA") city_airports("London","CAN") city_airports("London","124")