Skip to content

Commit

Permalink
Also store locations without county
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Mar 18, 2018
1 parent a2e8cb1 commit cf4e0cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions createdatabase.PL
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {

print "This will take some time.\nBest to do it last thing at night and go to sleep, it should be ready in the morning.\n";


my $filename = 'lib/Geo/Coder/Free/OpenAddresses/databases/states.txt';
if(-r $filename) {
# Import counties and states from https://github.com/openaddresses/openaddresses/tree/master/us-data
Expand Down Expand Up @@ -347,14 +346,14 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
$columns{$c} = delete $row->{$c};
}
insert($dbh, \%columns);
if(delete($columns{'COUNTY'})) {
insert($dbh, \%columns);
}
if(delete($columns{'NUMBER'})) {
# Match somewhere in the street when number isn't known
insert($dbh, \%columns);
if(delete($columns{'STREET'})) {
# Match somewhere in the city when street isn't known
# TODO: Work out a way to only do this once
# Could maintain a list of hashes and remove
# it all when starting a new state
insert($dbh, \%columns);
}
}
Expand Down Expand Up @@ -489,6 +488,9 @@ if(my $oa = $ENV{'OPENADDR_HOME'}) {
$columns{$c} = delete $row->{$c};
}
insert($dbh, \%columns);
if(delete($columns{'COUNTY'})) {
insert($dbh, \%columns);
}
if(delete($columns{'NUMBER'})) {
# Match somewhere in the street when number isn't known
insert($dbh, \%columns);
Expand Down

0 comments on commit cf4e0cf

Please sign in to comment.