]> granicus.if.org Git - postgis/commitdiff
Fix for #1310
authorRegina Obe <lr@pcorp.us>
Tue, 29 Nov 2011 08:49:06 +0000 (08:49 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 29 Nov 2011 08:49:06 +0000 (08:49 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8252 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2010/normalize/normalize_address.sql
extras/tiger_geocoder/tiger_2010/regress/normalize_address_regress
extras/tiger_geocoder/tiger_2010/regress/normalize_address_regress.sql

index accccb79122ea31fe578c9d1b91829364501968e..2fb8f12997eed6b166976dd2744e19885b5df1f7 100644 (file)
@@ -484,14 +484,16 @@ BEGIN
             RAISE NOTICE '% postDir exact match: %', clock_timestamp(), result.postDirAbbrev;
         END IF;
       ELSE
-        -- postDirection is not equal location, but may be contained in it.
+        -- postDirection is not equal location, but may be contained in it
+        -- It is only considered a postDirection if it is not preceded by a ,
         SELECT INTO tempString substring(result.location, '(?i)(^' || name
             || ')' || ws) FROM direction_lookup WHERE
             result.location ILIKE '%' || name || '%' AND texticregexeq(result.location, '(?i)(^' || name || ')' || ws)
+               AND NOT  texticregexeq(rawInput, '(?i)(,' || ws || '+' || result.location || ')' || ws)
             ORDER BY length(name) desc LIMIT 1;
             
         IF debug_flag THEN
-            RAISE NOTICE '% location trying to extract postdir: %', clock_timestamp(), result.location;
+            RAISE NOTICE '% location trying to extract postdir: %, tempstring: %, rawInput: %', clock_timestamp(), result.location, tempString, rawInput;
         END IF;
         IF tempString IS NOT NULL THEN
             postDir := tempString;
index cfb4a94cf70bc2a04fe4b0e2e8bbc75da982917f..4c8430db6f957265708aab785a50a5b69f72b08c 100644 (file)
@@ -38,4 +38,5 @@
 #1125c|19799 State Rte O, COSBY, MO 64436|19799||O|State Rte|||COSBY|MO|64436|t
 #1125d|I- 90, Boston, MA|||90|I-|||Boston|MA||t
 #1125e|I-90, Boston, MA|||I-90||||Boston|MA||t
-#1125f|I- 90, Boston, MA|||90|I-|||Boston|MA||t
\ No newline at end of file
+#1125f|I- 90, Boston, MA|||90|I-|||Boston|MA||t
+#1310a|1110 W CAPITOL Ave, WEST SACRAMENTO, CA|1110|W|CAPITOL|Ave|||WEST SACRAMENTO|CA||t
\ No newline at end of file
index c19f750f1b62ae49a46d6d644f477e5468e79f70..e440f3540725e4ccd39985006e202ae162a7fb15 100644 (file)
@@ -85,4 +85,7 @@ SELECT '#1125d' As ticket, pprint_addy(addy), addy.* FROM normalize_address('Int
 -- this one is wrong (because the lack of space trips it up) but will fix later
 SELECT '#1125e' As ticket, pprint_addy(addy), addy.* FROM normalize_address('I-90,Boston, MA') As addy;
 SELECT '#1125f' As ticket, pprint_addy(addy), addy.* FROM normalize_address('I 90,Boston, MA') As addy;
+
+-- location with prefixes getting caught in post prefix
+SELECT '#1310a' As ticket, pprint_addy(addy), addy.* FROM normalize_address('1110 W CAPITOL AVE, WEST SACRAMENTO, CA') As addy;
 \timing