From 470ee3041d636af555bf59eedf8f0943e20ca9da Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 11 Apr 2022 15:43:23 -0700 Subject: [PATCH] strip address suffixes for better census coding, RT#86245 --- FS/FS/Misc/Geo.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index 599b2a082..3beffc8a9 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -134,8 +134,11 @@ sub get_censustract_uscensus { my $url = 'https://geocoding.geo.census.gov/geocoder/geographies/address?'; + my $address1 = $location->{address1}; + $address1 =~ s/(apt|ste|suite|unit)[\s\d]\w*\s*$//i; + my $query_hash = { - street => $location->{address1}, + street => $address1, city => $location->{city}, state => $location->{state}, benchmark => 'Public_AR_Current', -- 2.11.0