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

NAME

Geography::Countries::LatLong - Mean latitude and longitude

SYNOPSIS

        use Geography::Countries::LatLong;
        if ( Geography::Countries::LatLong::supports('Hungary') ){
                my $array_ref    = latlong('Hungary');
                my ($lat, $long) = latlongr('Hungary');
        }

DESCRIPTION

This is version 1.0.

This module provides mean latitude and longitude for a large number of countries, named in English. Should translations become available, this module will happily move in Geography::Countries::EN::LatLong.

Regions and continents are not supported - please see the list below.

Look-up is by the English name of the country, as returned by the Geography::Countries module, of which this is a sub-class that exports none of its parent's properties or methods.

CHANGES SINCE VERSION 0.922

The mean values were once arrived at with the following MATLAB code, where name is a country name recognised by MATLAB:

        % You will need the Mapping Toolbox to run the above snippet.
        function [lat,lon] = country_latlon(name);
          load worldmtx;
          c=worldhi(name);
          lat = mean(c.latlim);
          lon = mean(c.longlim);
          fprintf( '"%s" => ["%.4f","%.4f"],', name,lat,lon);
        % end function country_latlon

The current dataset is derived from a variety of public-domain sources.

The data from the old $countries_latlong hash has been preserved in $countries_latlong_old. To force all routines to the old data, first call Geography::Countries::LatLong::USE_OLD_DATA.

DEPENDENCIES

This module requires this other modules:

  Geography::Countries

EXPORT

This module exports the following subroutines:

        countries
        latlong

SUBROUTINES

latlong ($country_name)

Returns as a 1x2 anonymous array the latitude and longitude for the country supplied as the sole argument, or undef if the country is not supported.

supports ($country)

Returns a true value if the sole argument is a country name supported by this module; otherwise, returns undef.

unsupported

warns to STDERR a list of Geography::Countries::countries that are not supported by this module.

country

Just Geography::Countries's routine.

full_status

Returns a hash that describes what is and is not supported by Geography::Countries, in relation to this module. Keys are code2 code3 numcode countries absent, of which all but the last relate to the lists returned by the countrY method ("The "country" subroutine." in Geography::Countries). These entries may be on the 'todo' list of the relevant ISO groups, or of the Geography::Countries author, though my money is on the former.

The absent key lists country names that are not supported: these are on my own 'todo' list.

The current value of this hash is:

        {
          'code2' => [
                                   'Isle of Man'
                                 ],
          'code3' => [
                                   'Antarctica',
                                   'Christmas Island',
                                   'Mayotte',
                                   'Heard Island and McDonald Islands',
                                   'British Indian Ocean Territory',
                                   'Heard Island And Mcdonald Islands',
                                   'South Georgia and the South Sandwich Islands',
                                   'Cocos (Keeling) Islands',
                                   'Bouvet Island'
                                 ],
          'numcode' => [
                                         'Antarctica',
                                         'Christmas Island',
                                         'Mayotte',
                                         'Heard Island and McDonald Islands',
                                         'British Indian Ocean Territory',
                                         'Heard Island And Mcdonald Islands',
                                         'South Georgia and the South Sandwich Islands',
                                         'Cocos (Keeling) Islands',
                                         'Bouvet Island'
                                   ],
          'countries' => [],
          'absent' => [
                                  'Antipodean Islands',
                                  'Antipodes',
                                  'Antipodes Islands',
                                  'Brunei Darussalam',
                                  'Canary Islands',
                                  'EEC',
                                  'EU',
                                  'European Union',
                                  'Faroc Islands',
                                  'Galapagos Islands',
                                  'Guatamala',
                                  'Independent State of Samoa',
                                  'Kermadec Islands',
                                  'Madeira Islands',
                                  'Micronesia-Polynesia',
                                  'Prince Edward Islands',
                                  'Saint Helena',
                                  'Western Samoa',
                                  'Yugoslavia',
                                  'Zaire'
                        ],
        }

USE_OLD_DATA

Sets the module to use data from veresion 0.922.

UNSUPPORTED NAMES

It is no reflection on the countries listed: I just don't have the data at the time of writing. All help appreicated, especially for Tibet, whose plight is being ignored by the Western powers against all ethical rhetoric, in favour of cheap trade with the totalitarian state that occupies this ancient land.

        Democratic Kampuchea
        Faeroe Islands
        French Southern Territories
        Melanesia
        Myanmar
        Pacific Islands (Trust Territory)
        Upper Volta
        Tibet

AUTHOR

Lee Goddard - lgoddard -at- cpan -dot- org

THANKS

Many thanks to Morten Bjørnsvik for checking and supplying data.

SEE ALSO

perl, Geography::Countries.

COPYRIGHT

Made publically available under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 2109:

Non-ASCII character seen before =encoding in 'Bjørnsvik'. Assuming CP1252