Perl modules t-geo-query-latlong
From Reto
[edit]
Bot 00:25, 24 June 2007 (CEST)
| See also |
| A – Z |
[edit]
4.1.1 Test it
Home >
Know-how >
Perl Modules >
Geo::Query::LatLong > Test it
| ← 4.1 Geo::Query::LatLong | [ up ] - [ top ] | 5 Theodor::Wagner → |
[edit]
Cut'n paste
#!/usr/bin/perl -w
use strict;
use Geo::Query::LatLong;
my $CITY = $ARGV[0] || 'Basel';
&main();
sub main() {
# my $geo = Geo::Query::LatLong->new( source => 'Google', apikey => 'your_api_key', debug => 0 );
my $geo = Geo::Query::LatLong->new();
my $res = $geo->query( city => $CITY );
# my $res = $geo->query( city => $CITY, country_code => 'SZ' );
print "Latitude and longitude of $CITY: ",
$res->{'lat'}, ' / ', $res->{'lng'}, "\n";
# List all results
foreach (keys %{$res}) {
print "-- $_ = ", $res->{$_}, "\n";
}
# Another example
print "Unterwalden ...\n";
$res = $geo->query( city => 'Unterwalden', country_code => 'SZ', exact => 'off' );
print "-- $_ = ", $res->{$_}, "\n" foreach keys %{$res};
}
