airportsdata

repository·main·Indexed 41 days ago

https://github.com/mborsetti/airportsdata

A database of location and timezone data for operational airports, landing strips, and seaplane bases worldwide. It provides access to ICAO, IATA, and LID identifiers along with geographic and administrative metadata. The Python package includes functions like load() for general airport data and load_iata_macs() for IATA Multi Airport Cities.

Tokens
2.8K
Snippets
5
Records
11
Agent score
51%

What's inside airportsdata

  1. Data formats for IATA Multi Airport Cities

    main

    The IATA Multi Airport Cities data is available in three formats:

    1. Python Dictionary: Accessible via airportsdata.load_iata_macs().
    2. CSV File: Named iata_macs.csv.
    3. In-line Table: Provided in the documentation for manual reference.
  2. How Pseudo-ICAO Identifiers are generated

    main

    The database generates Pseudo-ICAO Identifiers for airports that lack a standard ICAO Location Indicator. These identifiers allow the dataset to maintain a consistent 4-character identifier format. You can distinguish a Pseudo-ICAO from a true ICAO by checking for numbers or specific prefixes/suffixes.

    There are three main generation rules:

    1. 4-digit FAA LIDs: If a U.S. FAA-only entry has a 4-digit LID, that LID is used directly. These are identifiable because they contain at least one numeric character (true ICAO indicators are all letters).
    2. 3-digit FAA LIDs: If a U.S. FAA-only entry has a 3-digit LID, the identifier is generated by prefacing the LID with K (e.g., KXXX). To verify if a K-prefixed identifier is a real ICAO or a Pseudo-ICAO, inspect the LID field.
    3. IATA-only entries: For seaplane bases that have an IATA Location Code but no ICAO indicator, the identifier is generated by prefixing the IATA code with an underscore _ (e.g., _AYM).
  3. Load IATA Multi Airport Cities with load_iata_macs()

    main

    The airportsdata.load_iata_macs() function returns a Python dictionary containing IATA Multi Airport Cities (MACs). A MAC is a collection of airports that serve a single metropolitan area. The dictionary is keyed by the City Code (e.g., 'NYC').

    Each entry in the dictionary contains:

    • name: The name of the city.
    • country: The country code.
    • airports: A nested dictionary where keys are individual airport identifiers (IATA, ICAO, etc.) and values are dictionaries containing detailed airport metadata (name, lat, lon, elevation, etc.).

    Note: This dataset follows IATA resolution 011c. It does not include custom metropolitan codes used by specific GDSs (like Travelport's QBA) or surface transportation locations.

    import airportsdata
    
    # Load the Multi Airport Cities data
    # The keys are City Codes (e.g., 'NYC', 'LON', 'TYO')
    iata_macs = airportsdata.load_iata_macs()
    
    # Accessing a specific city's data
    nyc_data = iata_macs['NYC']
    print(nyc_data)
  4. Load airport data using load()

    main

    The airportsdata.load() function returns a dictionary of airport data. By default, the dictionary keys are the ICAO identifiers. You can also specify other identifier types as the argument to load().

    Available identifier types for keys:

    • ICAO (default): 4-letter Location Indicator or internal Pseudo-ICAO Identifier.
    • IATA: 3-letter Location Code.
    • LID: U.S. FAA Location Identifier.
    import airportsdata
    
    # Load using ICAO as keys (default)
    icao_airports = airportsdata.load()
    print(icao_airports['KJFK'])
    
    # Load using IATA as keys
    iata_airports = airportsdata.load('IATA')
    print(iata_airports['JFK'])
    
    # Load using LID as keys
    lid_airports = airportsdata.load('LID')
    print(lid_airports['01AA'])
  5. Data validation sources (Aeronautical Information Publication)

    main

    The data in this repository is validated against official Aeronautical Information Publications (AIP) or equivalent sources from various countries whenever available. This ensures the accuracy of the airport and facility data provided.

    Below is a reference list of some of the official sources used for validation, categorized by ISO 3166-1 country code.

    | Country (ISO 3166-1) | URL | notes |
    | --- | --- | --- |
    | AS | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | AU | https://www.airservicesaustralia.com/aip/aip.asp | |
    | BE | https://ops.skeyes.be/html/belgocontrol_static/eaip/eAIP_Main/html/index-en-GB.html | |
    | BR | https://aisweb.decea.mil.br/ | |
    | CA | https://www.navcanada.ca/en/aeronautical-information/aip-canada.aspx | |
    | CN | https://www.eaipchina.cn/ | Registration required |
    | DK | https://aim.naviair.dk/en/ | |
    | FM | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | FO | https://aim.naviair.dk/en/ | |
    | GB | https://nats-uk.ead-it.com/cms-nats/opencms/en/Publications/AIP/ | |
    | GL | https://aim.naviair.dk/en/ | |
    | GU | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | LK | https://www.airport.lk/aasl/AIS/web.Home.htm | |
    | IN | https://aim-india.aai.aero/ | |
    | IT | https://pre.enav.it/en/services/list | Registration required |
    | KH | http://www.civilaviation.gov.kh/en/2014-04-07-07-52-5/aip-cambodia/aip-sup | |
    | LU | https://ops.skeyes.be/html/belgocontrol_static/eaip/eAIP_Main/html/index-en-GB.html | |
    | MH | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | MP | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | MV | https://www.macl.aero/corporate/services/operational/ans/aip | |
    | PR | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | PT | https://ais.nav.pt/wp-content/uploads/AIS_Files/eAIP_Current/eAIP_Online/eAIP/html/index.html | |
    | RO | https://www.aisro.ro/ | No direct link: navigate Publications -> AIP -> AD_x.xx |
    | PW | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | RU | http://www.caiga.ru/products/?lang=en | |
    | SA | https://www.sans.com.sa/services/services-aim | |
    | SG | https://aim-sg.caas.gov.sg/ | Registration required |
    | UM | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
    | US | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory; we do not include airports with a "ARPT CLSD INDEFLY" remark |
    | VI | https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/dafd/ | Airport/Facility Directory |
  6. Structure of the IATA MACs dictionary

    main

    When using load_iata_macs(), the returned object follows this schema:

    {
        'NYC': {
            'airports': {
                'JFK': {
                    'city': 'New York',
                    'country': 'US',
                    'elevation': 13.0,
                    'iata': 'JFK',
                    'icao': 'KJFK',
                    'lat': 40.63993,
                    'lid': 'JFK',
                    'lon': -73.77869,
                    'name': 'John F Kennedy International Airport',
                    'subd': 'New York',
                    'tz': 'America/New_York'
                },
                'LGA': { ... }
            },
            'country': 'US',
            'name': 'New York'
        }
    }
  7. Identify U.S. FAA-only entries and Pseudo-ICAO rules

    main

    The database uses FAA data for operational public use airports in specific ISO 3166-1 countries/territories. For these entries, if an ICAO Location Indicator is missing, Pseudo-ICAO Identifiers are assigned based on the FAA LID:

    • 4-digit FAA LID: The LID is used as-is. (Contains numbers).
    • 3-digit FAA LID: Prefixed with K to create a 4-character identifier.

    Affected Countries/Territories:

    • AS (American Samoa)
    • FM (Micronesia)
    • GU (Guam)
    • MH (Marshall Islands)
    • MP (Northern Mariana Islands)
    • PR (Puerto Rico - saved as subdivision of US)
    • PW (Palau)
    • UM (United States Minor Outlying Islands)
    • US (United States)
    • VI (Virgin Islands - saved as subdivision of US)