[postgis-users] Problem with pagc_normalize_address() results...

Stephen Woodbridge woodbri at swoodbridge.com
Tue Oct 29 20:59:30 PDT 2013


The underlying code the parses the address string into fields is 
parse_address(string)

stdaddr=# select * from parse_address('16 Berry Lane, schenectady, ny 
12302');
  num |   street   | street2 |   address1    |    city     | state | 
zip  | zipplus | country
-----+------------+---------+---------------+-------------+-------+-------+---------+---------
  16  | Berry Lane |         | 16 Berry Lane | schenectady | NY    | 
12302 |         | US
(1 row)

stdaddr=# select * from parse_address('16 Berry Lane, skenectady, ny 
12302');
  num |         street         | street2 |         address1          | 
city | state |  zip  | zipplus | country
-----+------------------------+---------+---------------------------+------+-------+-------+---------+---------
  16  | Berry Lane, skenectady |         | 16 Berry Lane, skenectady | 
     | NY    | 12302 |         | US
(1 row)

This one looks like the problem and I think this is a bug based on the 
intended coding. I thought this would split on the commas if they 
existed, but maybe that was changed.

Removing the comma between street and city does work:

stdaddr=# select * from parse_address('16 Berry Lane skenectady, ny 12302');
  num |   street   | street2 |   address1    |    city    | state |  zip 
  | zipplus | country
-----+------------+---------+---------------+------------+-------+-------+---------+---------
  16  | Berry Lane |         | 16 Berry Lane | skenectady | NY    | 
12302 |         | US
(1 row)

The simplest solution for now might be to remove the commas like:

stdaddr=# select * from parse_address(replace('16 Berry Lane, 
skenectady, ny 12302',',',''));
  num |   street   | street2 |   address1    |    city    | state |  zip 
  | zipplus | country
-----+------------+---------+---------------+------------+-------+-------+---------+---------
  16  | Berry Lane |         | 16 Berry Lane | skenectady | NY    | 
12302 |         | US
(1 row)

http://trac.osgeo.org/postgis/ticket/2522

-Steve

On 10/29/2013 10:27 PM, crowmagnumb wrote:
> I have installed the adress_standardizer (version 1.0) into a fresh install
> of postgresql 9.3.1 with postgis 2.1.0 and I am finding an issue with the
> address normalizer.
>
> If I give the following valid address, it works...
>
> db=# select internal, location, stateabbrev from pagc_normalize_address('16
> Berry Lane, schenectady, ny 12302');
>   internal |  location   | stateabbrev
> ----------+-------------+-------------
>            | SCHENECTADY | NY
>
> ... but if I intentionally misspell schenectady (because I'm trying to get a
> function to work using soundex() to allow misspellings), then it doesn't
> work ....
>
> db=# select internal, location, stateabbrev from pagc_normalize_address('16
> Berry Lane, skenectady, ny 12302');
>     internal   | location | stateabbrev
> --------------+----------+-------------
>   # SKENECTADY | NEW YORK |
>
>
> ... the misspelled town is put into the internal field and the location
> becomes New York spelled out.  But then if I get rid of the comma between
> Lane and the town but still misspell it, it parses as I expect...
>
> ksedb=# select internal, location, stateabbrev from
> pagc_normalize_address('16 Berry Lane skenectady, ny 12302');
>   internal |  location  | stateabbrev
> ----------+------------+-------------
>            | SKENECTADY | NY
>
> ... with the location being the incorrectly spelled town name.
>
> Any ideas why this subtle difference occurs?
>
>
>
>
>
> --
> View this message in context: http://postgis.17.x6.nabble.com/Problem-with-pagc-normalize-address-results-tp5004678.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list