Skip to content

Commit

Permalink
Handle mz:is_current in WOF databases
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Sep 26, 2018
1 parent 27f0a26 commit c64155a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions createdatabase.PL
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
$data = $j->decode($data);
my $properties = $data->{'properties'};
next if(scalar(@{$properties->{'wof:superseded_by'}}));
next if(!$properties->{'mz:is_current'});
my $placetype = $properties->{'wof:placetype'};
next if($placetype eq 'country');
my $country = $properties->{'wof:country'};
Expand Down Expand Up @@ -845,6 +846,7 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
$data = $j->decode($data);
my $properties = $data->{'properties'};
next if(scalar(@{$properties->{'wof:superseded_by'}}));
next if(!$properties->{'mz:is_current'});
next if($properties->{'wof:country'} ne uc($country));
my $city = $properties->{'sg:city'};
# Don't trust sg:city to be correct
Expand Down Expand Up @@ -983,6 +985,7 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {

my $properties = $data->{'properties'};
next if(scalar(@{$properties->{'wof:superseded_by'}}));
next if(!$properties->{'mz:is_current'});
next if($properties->{'wof:country'} ne uc($country));
my $street = $properties->{'addr:street'};
next if(!defined($street));
Expand Down Expand Up @@ -1741,6 +1744,7 @@ sub get_wof {
$data = JSON->new()->utf8()->decode(@{$data});
my $properties = $data->{'properties'};
return if(scalar(@{$properties->{'wof:superseded_by'}}));
return if(!$properties->{'mz:is_current'});
# if($properties->{'wof:name'}) {
if($properties->{'wof:placetype'} eq 'region') {
my $country = $properties->{'wof:country'};
Expand Down

0 comments on commit c64155a

Please sign in to comment.