Created
October 22, 2011 07:30
-
-
Save sebnow/1305743 to your computer and use it in GitHub Desktop.
Geocoding in Perl using Google Maps API v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Geo::Coder::Google; | |
my $geocoder = Geo::Coder::Google->new(apiver => 3); | |
print(join(', ', qw(Address Lattitude Longitude)) . "\n"); | |
while(my $address = <>) { | |
my $location = $geocoder->geocode(location => $address); | |
print(join(', ', | |
$address, | |
$location->{'geometry'}->{'location'}->{'lat'}, | |
$location->{'geometry'}->{'location'}->{'lng'}, | |
) . "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment