Geography::Countries::LatLong - Mean latitude and longitude
use Geography::Countries::LatLong; if ( Geography::Countries::LatLong::supports('Hungary') ){ my $array_ref = latlong('Hungary'); my ($lat, $long) = latlongr('Hungary'); }
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.
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.
Geography::Countries
The mean values were once arrived at with the following MATLAB code, where name is a country name recognised by MATLAB:
name
% 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.
$countries_latlong
$countries_latlong_old
DEPENDENCIES
This module requires this other modules:
This module exports the following subroutines:
countries latlong
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.
undef
Returns a true value if the sole argument is a country name supported by this module; otherwise, returns undef.
warns to STDERR a list of Geography::Countries::countries that are not supported by this module.
warn
STDERR
Geography::Countries::countries
Just Geography::Countries's routine.
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.
code2 code3 numcode countries absent
The absent key lists country names that are not supported: these are on my own 'todo' list.
absent
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' ], }
Sets the module to use data from veresion 0.922.
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
Lee Goddard - lgoddard -at- cpan -dot- org
Many thanks to Morten Bjørnsvik for checking and supplying data.
perl, Geography::Countries.
Made publically available under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Bjørnsvik'. Assuming CP1252
To install Geography::Countries::LatLong, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geography::Countries::LatLong
CPAN shell
perl -MCPAN -e shell install Geography::Countries::LatLong
For more information on module installation, please visit the detailed CPAN module installation guide.