The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Geo::ICAO - Airport and ICAO codes lookup

VERSION

version 1.100140

SYNOPSIS

    use Geo::ICAO qw{ :all };

    my @region_codes = all_region_codes();
    my @region_names = all_region_names();
    my $code   = region2code('Canada');
    my $region = code2region('C');

    my @country_codes = all_country_codes();
    my @country_names = all_country_names();
    my @codes  = country2code('Brazil');
    my $region = code2country('SB');

    my @airport_codes = all_airport_codes('B');
    my @airport_names = all_airport_names('B');
    my $code    = airport2code('Lyon Bron Airport');
    my $airport = code2airport('LFLY');
    my ($airport, $location) = code2airport('LFLY'); # list context

DESCRIPTION

The International Civil Aviation Organization (ICAO), a major agency of the United Nations, codifies the principles and techniques of international air navigation and fosters the planning and development of international air transport to ensure safe and orderly growth. Among the standards defined by ICAO is an airport code system (not to be confused with IATA airport codes), using 4-letter for this.

This module provides easy access to the list of airport ICAO codes, with mapping of those codes with airport names, country and region codes.

Nothing is exported by default, but all the functions described below are exportable: it's up to you to decide what you want to import. Export is done with Sub::Exporter, so you can play all kind of tricks.

Note that the keyword :all will import everything, and each category of function provides its own keyword. See below.

Regions

The first letter of an ICAO code refer to the region of the airport. The region is quite loosely defined as per the ICAO. This set of functions allow retrieval and digging of the regions.

Note: you can import all those functions with the :region keyword.

Countries

The first two letters of an ICAO code refer to the country of the airport. Once again, the rules are not really set in stone: some codes are shared by more than one country, some countries are defined more than once... and some countries (Canada, USA, Russia, Australia and China) are even coded on only one letter - ie, the country is the same as the region). This set of functions allow retrieval and digging of the countries.

Note: you can import all those functions with the :country keyword.

Airports

This set of functions allow retrieval and digging of the airports, which are defined on 4 letters.

Note: you can import all those functions with the :airport keyword.

REGION FUNCTIONS

my @codes = all_region_codes();

Return the list of all single letters defining an ICAO region. No parameter needed.

my @regions = all_region_names();

Return the list of all ICAO region names. No parameter needed.

my $code = region2code( $region );

Return the one-letter ICAO $code corresponding to $region. If the region does not exist, return undef.

my $region = code2region( $code );

Return the ICAO $region corresponding to $code. Note that $code can be a one-letter code (region), two-letters code (country) or a four- letters code (airport): in either case, the region will be returned.

Return undef if the associated region doesn't exist.

COUNTRIES FUNCTIONS

my @codes = all_country_codes( [$code] );

Return the list of all single- or double-letters defining an ICAO country. If a region $code is given, return only the country codes of this region. (Note: dies if $code isn't a valid ICAO region code).

my @countries = all_country_names( [$code] );

Return the list of all ICAO country names. If a region $code is given, return only the country names of this region. (Note: dies if $code isn't a valid ICAO region code).

my @codes = country2code( $country );

Return the list of ICAO codes corresponding to $country. It's a list since some countries have more than one code. Note that the codes can be single-letters (USA, etc.)

my $country = code2country( $code );

Return the ICAO $country corresponding to $code. Note that $code can be a classic country code, or a four-letters code (airport): in either case, the region will be returned.

Return undef if the associated region doesn't exist.

AIRPORT FUNCTIONS

my @codes = all_airport_codes( $code );

Return the list of all ICAO airport codes in the $code country ($code can also be a region code). Note that compared to the region or country equivalent, this function requires an argument. It will die otherwise (or if $code isn't a valid ICAO country or region code).

my @codes = all_airport_names( $code );

Return the list of all ICAO airport names in the $code country ($code can also be a region code). Note that compared to the region or country equivalent, this function requires an argument. It will die otherwise (or if $code isn't a valid ICAO country or region code).

my $code = airport2code( $airport );

Return the $code of the $airport, undef i no airport matched. Note that the string comparison is done on a case-insensitive basis.

my $airport = code2airport( $code );

Return the $airport name corresponding to $code. In list context, return both the airport name and its location (if known).

SEE ALSO

You can look for information on this module at:

AUTHOR

  Jerome Quelin

COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Jerome Quelin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.