[postgis-tickets] r14850 - prevent error when tiger street number is not a number (just return first number part)

Regina Obe lr at pcorp.us
Sun Apr 17 14:49:37 PDT 2016


Author: robe
Date: 2016-04-17 14:49:37 -0700 (Sun, 17 Apr 2016)
New Revision: 14850

Modified:
   trunk/extras/tiger_geocoder/geocode/geocode_address.sql
   trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql
Log:
prevent error when tiger street number is not a number (just return first number part)
Closes #3531 for trunk (PostGIS 2.3.0)

Modified: trunk/extras/tiger_geocoder/geocode/geocode_address.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode_address.sql	2016-04-17 21:45:32 UTC (rev 14849)
+++ trunk/extras/tiger_geocoder/geocode/geocode_address.sql	2016-04-17 21:49:37 UTC (rev 14850)
@@ -392,7 +392,7 @@
       END IF;
 
       IF results.exact_address THEN
-        ADDY.address := parsed.address;
+        ADDY.address := substring(parsed.address FROM '[0-9]+')::integer;
       ELSE
         ADDY.address := NULL;
       END IF;

Modified: trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql
===================================================================
--- trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql	2016-04-17 21:45:32 UTC (rev 14849)
+++ trunk/extras/tiger_geocoder/geocode/geocode_intersection.sql	2016-04-17 21:49:37 UTC (rev 14850)
@@ -1,6 +1,6 @@
  /*** 
  * 
- * Copyright (C) 2011 Regina Obe and Leo Hsu (Paragon Corporation)
+ * Copyright (C) 2011-2016 Regina Obe and Leo Hsu (Paragon Corporation)
  **/
 -- This function given two roadways, state and optional city, zip
 -- Will return addresses that are at the intersecton of those roadways
@@ -140,7 +140,7 @@
         ADDY.stateAbbrev      := in_state;
         ADDY.zip              := results.zip;
         ADDY.parsed := TRUE;
-        ADDY.address := results.address;
+        ADDY.address := substring(results.address FROM '[0-9]+')::integer;
         
         GEOMOUT := results.geom;
         RATING := results.a_rating;



More information about the postgis-tickets mailing list