summaryrefslogtreecommitdiff
path: root/Geocoding/Match.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-30 13:01:27 -0800
committerMark Wells <mark@freeside.biz>2014-11-30 13:01:27 -0800
commit83646ffc2d229a706bdf3f90bf3cc8834c03106f (patch)
tree8905058d84afd2ab8b2bee1462801a609fa7019b /Geocoding/Match.pm
parent2abefcaec0a7fbc3f320e0c251de81144ca6bd93 (diff)
adjustments
Diffstat (limited to 'Geocoding/Match.pm')
-rw-r--r--Geocoding/Match.pm21
1 files changed, 16 insertions, 5 deletions
diff --git a/Geocoding/Match.pm b/Geocoding/Match.pm
index 6584203..b4a7675 100644
--- a/Geocoding/Match.pm
+++ b/Geocoding/Match.pm
@@ -1,6 +1,7 @@
package Geo::USCensus::Geocoding::Match;
use strict;
+use Data::Dumper;
sub new {
my $class = shift;
@@ -31,13 +32,23 @@ sub geographies {
$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;
- 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};
+ my $block = $self->block_info or return '';
+ return $block->{STATE} . $block->{COUNTY} . $block->{TRACT};
}
1;