WWW::Gazetteer::GettyFind location of world towns and cities | |
Download |
WWW::Gazetteer::Getty Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Leon Brocard
- Publisher web site:
- http://search.cpan.org/~lbrocard/
WWW::Gazetteer::Getty Tags
WWW::Gazetteer::Getty Description
Find location of world towns and cities A gazetteer is a geographical dictionary (as at the back of an atlas). The WWW::Gazetteer::Getty module uses the information at http://www.getty.edu/research/conducting_research/vocabularies/tgn/ to return geographical location (longitude, latitude) for towns and cities in countries in the world.WWW::Gazetteer::Getty 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; print $london->{longitude}, ", ", $london->{latitude}, " "; # prints -0.1167, 51.5000The 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.SYNOPSYS use WWW::Gazetteer; my $g = WWW::Gazetteer::Getty->new('getty'); my @londons = $g->find('London', 'UK'); my $london = $londons; print $london->{longitude}, ", ", $london->{latitude}, " "; my $nice = $g->find("Nice", "France")->; print $nice->{city}, ", ", $nice->{elevation}, " "; Requirements: · Perl
WWW::Gazetteer::Getty Related Software