NAME
WWW::Gazetteer - Find location of world towns and cities
SYNOPSYS
use WWW::Gazetteer;
my $g = WWW::Gazetteer->new();
my $london = $g->fetch("London", "United Kingdom");
print $london->{longitude}, ", ", $london->{latitude}, "\n";
my $nice = $g->fetch("Nice", "France");
my @bactons = $g->fetch("Bacton", "United Kingdom");
# note: more than one Bacton in the UK!
DESCRIPTION
A gazetteer is a geographical dictionary (as at the back of an atlas).
The `WWW::Gazetteer' module uses the information at
http://www.calle.com/world/ to return geographical location (longitude,
latitude) for towns and cities in countries in the world.
Once you have imported the module and created a gazetteer object,
calling fetch($town, $country) will return a list of hashrefs with
longitude and latitude information.
my $london = $g->fetch("London", "United Kingdom");
print $london->{longitude}, ", ", $london->{latitude}, "\n";
# prints -0.1167, 51.5000
Note that there may be more than one town or city with that name in the
country. In that case, you will get a list of hashrefs for each
town/city.
The following countries are valid:...
and US cities? (Score:1)
thanks
kellan
Re:and US cities? (Score:2)
Re:and US cities? (Score:2)
The US info is available from the US Census Bureau website either as a database [census.gov] or a query form [census.gov].
Another database of geographical data (Score:1)
Here's another database, that has lots of cities and aliases, with longitude, latitude and elevation: http://www.heavens-above.com/countries.asp [heavens-above.com].
I've built a script that sucks the whole database (it was the subject of one of my lightning talks in Munich), but maybe it could be turned into a module, too. Is there room for this in the WWW::Gazetteer namespace?
Re:Another database of geographical data (Score:2)
Re:Another database of geographical data (Score:1)
Well, my script still needs to implement the optimisations I talked about in Munich... But if you provide a generic WWW::Gazetteer API, I can make WWW::Gazetteer::HeavensAbove follow it.
If the module doesn't have to fetch the results of a request like "a*", and work around the 200+ answers limitation, that should be quick and easy (provided I find enough spare time to do it, obviously).
Re:Another database of geographical data (Score:1)
Elevation is useful, if you want to produce a proper ICBM block [tuxedo.org] for each perl monger group.
I'm not sure who this would be useful for - it seems that we know Saddam Hussein's favourite brand of chocolate (Quality Street [bbc.co.uk]) and computer manufacture (Sun [theregister.co.uk]) - but do we have any idea what his favourite programming language is, and hence if we should be afraid?