sub __getLatLngCoords
{
my ($self, $addy) = @_;
my $geocoder = Geo::Coder::Google->new(apiver => 3, key => '<PLACE GOOGLE KEY HERE>', sensor => 'false');
my $location = $geocoder->geocode(location => $addy);
my $lat = '';
my $lng = '';
$lat = $location->{geometry}{location}{lat};
$lng = $location->{geometry}{location}{lng};
my @coords;
if ($lat && $lng)
{
#print "$addy\n";
push (@coords, $lat);
push (@coords, $lng);
#print "Addy: @coords\n";
}
else
{
push (@coords, "NA");
push (@coords, "NA");
}
#print "Alt Addy: @coords\n";
return @coords;
}
No comments:
Post a Comment