Skip to content

Instantly share code, notes, and snippets.

@sebnow
Created October 22, 2011 07:30
Show Gist options
  • Save sebnow/1305743 to your computer and use it in GitHub Desktop.
Save sebnow/1305743 to your computer and use it in GitHub Desktop.
Geocoding in Perl using Google Maps API v3
#!/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