Find location of world towns and cities
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


    WWW::Gazetteer::Getty - Find location of world towns and cities

      use WWW::Gazetteer;
      my $g = WWW::Gazetteer::Getty->new('getty');
      my @londons = $g->find('London', 'UK');
      my $london = $londons[0];
      print $london->{longitude}, ", ", $london->{latitude}, "\n";
      my $nice = $g->find("Nice", "France")->[0];
      print $nice->{city}, ", ", $nice->{elevation}, "\n";

    A gazetteer is a geographical dictionary (as at the back of an atlas).
    The "WWW::Gazetteer::Getty" module uses the information at to
    return geographical location (longitude, latitude) for towns and cities
    in countries in the world.

    This module is a subclass of "WWW::Gazetteer", so you must use that to
    create a "WWW::Gazetteer::Getty" object. Once you have imported the
    module and created a gazetteer object, calling find($country => $town)
    will return a list of hashrefs with longitude and latitude information.

      my @londons = $g->find('London', 'UK');
      my $london = $londons[0];
      print $london->{longitude}, ", ", $london->{latitude}, "\n";
      # prints -0.1167, 51.5000

    The hashref for London actually looks like this:

      $london = {
        longitude => "-0.167",
        latitude  => "51.500",
        city      => 'London',
        country   => 'United Kingdom',

    The city and country values are the same as the ones you used. The
    longitude and latitude are in degrees, ranging from -180 to 180 where
    (0, 0) is on the Prime Meridian and the equator.

    This returns a new WWW::Gazetteer::Getty object. It currently has no

      use WWW::Gazetteer;
      my $g = WWW::Gazetteer->new('getty');

    The find method looks up geographical information and returns it to you.
    It takes in a country and a city, with the recommended syntax being a
    city name and ISO 3166 code.

    Note that there may be more than one town or city with that name in the
    country. You will get a list of hashrefs for each town/city.

      my @londons = $g->find("London", "UK");
      my @londons = $g->find("London", "United Kingdom");

    The following countries are valid (as are their ISO 3166 codes):
    Afghanistan, Albania, Algeria, American Samoa, Andorra, Angola,
    Anguilla, Antarctica, Antigua and Barbuda, Argentina, Armenia, Aruba,
    Australia, Austria, Azerbaijan, Bahamas, Bahrain, Bangladesh, Barbados,
    Belarus, Belgium, Belize, Benin, Bermuda, Bhutan, Bolivia, Bosnia and
    Herzegovina, Botswana, Bouvet Island, Brazil, British Indian Ocean
    Territory, Brunei Darussalam, Bulgaria, Burkina Faso, Burundi, Cambodia,
    Cameroon, Canada, Cape Verde, Cayman Islands, Central African Republic,
    Chad, Chile, China, Christmas Island, Cocos (Keeling) Islands, Colombia,
    Comoros, Congo, Cook Islands, Costa Rica, Cote D'Ivoire, Croatia, Cuba,
    Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic,
    East Timor, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea,
    Estonia, Ethiopia, Falkland Islands (Malvinas), Faroe Islands, Fiji,
    Finland, France, France, Metropolitan, French Guiana, French Polynesia,
    French Southern Territories, Gabon, Gambia, Georgia, Germany, Ghana,
    Gibraltar, Greece, Greenland, Grenada, Guadeloupe, Guam, Guatemala,
    Guinea, Guinea-Bissau, Guyana, Haiti, Heard Island and McDonald Islands,
    Holy See (Vatican City State), Honduras, Hong Kong, Hungary, Iceland,
    India, Indonesia, Iran, Islamic Republic of, Iraq, Ireland, Israel,
    Italy, Jamaica, Japan, Jordan, Kazakhstan, Kenya, Kiribati, Korea,
    Democratic People's Republic of, Korea, Republic of, Kuwait, Kyrgyzstan,
    Lao People's Democratic Republic, Latvia, Lebanon, Lesotho, Liberia,
    Libyan Arab Jamahiriya, Liechtenstein, Lithuania, Luxembourg, Macao,
    Macedonia, the Former Yugoslav Republic of, Madagascar, Malawi,
    Malaysia, Maldives, Mali, Malta, Marshall Islands, Martinique,
    Mauritania, Mauritius, Mayotte, Mexico, Micronesia, Federated States of,
    Moldova, Republic of, Monaco, Mongolia, Montserrat, Morocco, Mozambique,
    Myanmar, Namibia, Nauru, Nepal, Netherlands, Netherlands Antilles, New
    Caledonia, New Zealand, Nicaragua, Niger, Nigeria, Niue, Norfolk Island,
    Northern Mariana Islands, Norway, Oman, Pakistan, Palau, Palestinian
    Territory, Occupied, Panama, Papua New Guinea, Paraguay, Peru,
    Philippines, Pitcairn, Poland, Portugal, Puerto Rico, Qatar, Reunion,
    Romania, Russian Federation, Rwanda, Saint Helena, Saint Kitts and
    Nevis, Saint Lucia, Saint Pierre and Miquelon, Saint Vincent and the
    Grenadines, Samoa, San Marino, Sao Tome and Principe, Saudi Arabia,
    Senegal, Seychelles, Sierra Leone, Singapore, Slovakia, Slovenia,
    Solomon Islands, Somalia, South Africa, South Georgia and the South
    Sandwich Islands, Spain, Sri Lanka, Sudan, Suriname, Svalbard and Jan
    Mayen, Swaziland, Sweden, Switzerland, Syrian Arab Republic, Taiwan,
    Province of China, Tajikistan, Tanzania, United Republic of, Thailand,
    Togo, Tokelau, Tonga, Trinidad and Tobago, Tunisia, Turkey,
    Turkmenistan, Turks and Caicos Islands, Tuvalu, Uganda, Ukraine, United
    Arab Emirates, United Kingdom, United Kingdom, United States, United
    States Minor Outlying Islands, Uruguay, Uzbekistan, Vanuatu, Venezuela,
    Vietnam, Virgin Islands, British, Virgin Islands, U.S., Wallis and
    Futuna, Western Sahara, Yemen, Yugoslavia, Zaire, Zambia, Zimbabwe.

    Note that there may be bugs in the Getty database. Do not rely on this
    module for navigation.

    Copyright (C) 2002-9, Leon Brocard

    This module is free software; you can redistribute it or modify it under
    the same terms as Perl itself.

    Leon Brocard,