summaryrefslogtreecommitdiff
path: root/Geocoding/Match.pm
blob: 65842035f7b6ce44ee618546813f2b58aaec16ba (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
package Geo::USCensus::Geocoding::Match;

use strict;

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 censustract {
  my $self = shift;
  return '' unless $self->geographies
                and exists($self->geographies->{'Census Tracts'})
                and exists($self->geographies->{'Census Tracts'}->[0]);
  my $ct = $self->geographies->{'Census Tracts'}->[0];
  return $ct->{STATE} . $ct->{COUNTY} . $ct->{TRACT};
}

1;