Package 'airportr'

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

Help Index


Lookup full airport details based of a standard airport input

Description

Return all airport details given an input IATA code, ICAO code, or airport name.

Usage

airport_detail(input, input_type)

Arguments

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

Value

A 1x14 tibble with airport details

Examples

airport_detail("YVR")
airport_detail("London Heathrow Airport")

Calculate great circle distance between two airports

Description

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.

Usage

airport_distance(airport1, airport2)

Arguments

airport1

Takes a three-letter IATA code corresponding to an airport

airport2

As above

Value

The great circle distance in kilometres between the two airports

Examples

airport_distance("YVR","YYZ")

Lookup airport location coordinates given a standard airport input.

Description

Returns airport location in longitude and latitude coordinates given an input IATA code, ICAO code, or airport name.

Usage

airport_location(input, input_type)

Arguments

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

Value

List of longitude and latitude coordinates

Examples

airport_location("YVR","IATA")
#' airport_location("Vancouver International Airport","name")

Translate airport codes or names into other standard airport formats

Description

Return city name, airport name, IATA code, or IACO code given an input IATA code, ICAO code, or airport name.

Usage

airport_lookup(input, input_type = "IATA", output_type = "name")

Arguments

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

Value

The appropriate city, airport name, IATA code, or ICAO code for that airport

Examples

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

airportr package

Description

Package to work with airport data

Details

See the README on GitHub


Table of airport detail data

Description

A dataset containing names, codes, locations, altitude, and timezones for airports

Usage

airports

Format

A data frame with 7698 rows and 14 variables:

OpenFlights ID

OpenFlights database ID

Name

Airport name, sometimes contains name of the city

City

Name of city served by airport

IATA

3-letter IATA code

ICAO

4-letter ICAO code

Country

Country name as in OpenFlights database. Note that country names may not be ISO 3166-1 standard.

Country Code

ISO 3166-1 numeric country code

Country Code (Alpha-2)

Name of city served by airport

Country Code (Alpha-3)

Name of country where airport is located

Latitude

Latitude in decimal degrees

Longitude

Longitude in decimal degrees

Altitude

Altitude in feet

UTC

Hours offset from UTC

DST

Daylight savings time. One of E (Europe), A (US/Canada), S (South America), O (Australia), Z (New Zealand), N (None) or U (Unknown)

Timezone

Timezone in Olson format

Type

Type of airport

Source

Source of data. Airport data generally sourced from OurAirports

Source

https://openflights.org/data.html


Lookup airports near specified coordinates

Description

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.

Usage

airports_around(lat, lon, distance = 100)

Arguments

lat

Latitude in decimal degrees

lon

Longitude in decimal degrees

distance

Distance boundary for nearest airport lookup in kilometres

Value

A tibble of airports that fall within the specified range of specified location

Examples

airports_around(-123,49.2)

# Or with a user specified distance in kilometres
airports_around(-123, 49.2, distance = 200)

Lookup airports nearby other airports

Description

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

Usage

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

# Or with a user specified distance in kilometres
airports_near_airport("YVR", distance = 200)

Return all airports serving an input city.

Description

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.

Usage

city_airports(city, country)

Arguments

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.

Value

A Nx17 tibble with airport details where n is the number of airports serving that city

Examples

city_airports("Vancouver")
city_airports("London")
city_airports("London","Canada")
city_airports("London","CA")
city_airports("London","CAN")
city_airports("London","124")