NAME
Geo::Query::LatLong - Perl module to query latitude and longitude from a city.
SYNOPSIS
use Geo::Query::LatLong;
$geo = Geo::Query::LatLong->new( debug => 0 );
DESCRIPTION
Query latitude and longitude from any city in any country.
Query example
use Geo::Query::LatLong;
$CITY = $ARGV[0] || 'Zurich';
$res = $geo->query( city => $CITY, country_code => 'SZ' ); # FIPS 10 country code
print "Latitude and longitude of $CITY: ",
$res->{'lat'}, ' / ', $res->{'lng'}, "\n";
# List all results
foreach (keys %{$res}) {
print "$_ = ", $res->{$_}, "\n";
}
Another example
# Switch exactness to "off" increase the chance you get a result.
$res = $geo->query( city => 'Unterwalden', country_code => 'SZ', exact => 'off' ); # exact default: on
print "-- $_ = ", $res->{$_}, "\n" foreach keys %{$res};
Parameter country_code
Country Codes according to FIPS 10: http://de.wikipedia.org/wiki/FIPS_10
Parameter city
Use the english translations for the city names, e.g. Zurich for Zuerich, Munich for Muenchen.
EXPORT
None by default.
SEE ALSO
http://meta.pgate.net/perl-modules/
http://www.infocopter.com/perl/modules/
AUTHOR
Reto Schaer, <retoh@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2007 by Reto Schaer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
http://www.infocopter.com/perl/licencing.html