Skip to content

Commit

Permalink
Better handling of less precise locations
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Feb 24, 2018
1 parent b2c76bb commit 56bd787
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Geo/Coder/Free.pm
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ sub geocode {
$location =~ s/\s$//g;
$country =~ s/^\s//g;
$country =~ s/\s$//g;
if(!country2code($country)) {
$county = $country;
$country = undef;
}
} else {
# TODO: Parse full postal address
die 'TODO - add support for full addresses on openaddr';
Expand All @@ -214,7 +218,7 @@ sub geocode {
Carp::croak(__PACKAGE__, ' only supports towns, not full addresses when openaddr is not given');
return;
}
if(($country eq 'UK') || ($country eq 'United Kingdom')) {
if(defined($country) && (($country eq 'UK') || ($country eq 'United Kingdom'))) {
$country = 'Great Britain';
$concatenated_codes = 'GB';
}
Expand Down

0 comments on commit 56bd787

Please sign in to comment.