blob: b4a76757c2f5487706ff7912b0b7e668a9cfb0d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package Geo::USCensus::Geocoding::Match;
use strict;
use Data::Dumper;
sub new {
my $class = shift;
my $address = shift;
my $census = shift;
my $self = { %$address };
bless $self, $class;
}
sub matchedAddress {
my $self = shift;
$self->{matchedAddress};
}
sub coordinates {
my $self = shift;
$self->{coordinates};
}
sub addressComponents {
my $self = shift;
$self->{addressComponents};
}
sub geographies {
my $self = shift;
$self->{geographies};
}
sub block_info {
my $self = shift;
my $geo = $self->{geographies};
my $block_info = $geo->{'2010 Census Blocks'}; # XXX change this in 2020
if ($block_info and exists($block_info->[0])) {
return $block_info->[0];
} else {
warn "2010 Census Blocks element not found in response\n";
warn Dumper $self->{geographies};
return '';
}
}
sub censustract {
my $self = shift;
my $block = $self->block_info or return '';
return $block->{STATE} . $block->{COUNTY} . $block->{TRACT};
}
1;
|