Geo::ICAO - Airport and ICAO codes lookup
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
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.
Note that the keyword :all will import everything, and each category
of function provides its own keyword.
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.
all_region_codes()
Return the list of all single letters defining an ICAO region. No parameter needed.
all_region_names()
Return the list of all ICAO region names. No parameter needed.
Return the one-letter ICAO $code corresponding to $region. If the
region does not exist, return undef.
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.
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.
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).
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).
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.)
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.
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.
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).
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).
Return the $code of the $airport, undef i no airport matched. Note
that the string comparison is done on a case-insensitive basis.
Return the $airport name corresponding to $code. In list context,
return both the airport name and its location (if known).
Please report any bugs or feature requests to < bug-geo-icao at
rt.cpan.org>, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html. I will be
notified, and then you'll automatically be notified of progress on your
bug as I make changes.
Geo::ICAO development takes place on http://geo-icao.googlecode.com
- feel free to join us.
You can also look for information on this module at:
Jerome Quelin, <jquelin at cpan.org>
Copyright (c) 2007 Jerome Quelin, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.