Opened 13 years ago

Closed 12 years ago

#1600 closed defect (fixed)

normalize_address() confused by whitespace

Reported by: mikepease Owned by: robe
Priority: medium Milestone: PostGIS 2.1.0
Component: pagc_address_parser Version: 1.5.X
Keywords: Cc: woodbri

Description

If there is a tab or newline at the beginning or end of an address string, normalize_address() incorrectly parses the address components.

select * from normalize_address('212 n 3rd ave, Minneapolis, mn 55401 ')

select * from normalize_address(' 212 n 3rd ave, Minneapolis, mn 55401')

Can your function start off by cleaning up whitespace on the input string? When I don't make sure to send input clean of whitespace, I get poor results.

Something like… trim(regexp_replace(' 212 n 3rd ave, Minneapolis, mn 55401', '\r|\n', ' ', 'g'))

e.g. select normalize_address(trim(raw_address))

Change History (6)

comment:1 by robe, 13 years ago

Status: newassigned

comment:2 by robe, 13 years ago

Milestone: PostGIS 2.0.0PostGIS 2.1.0

comment:3 by woodbri, 12 years ago

Cc: woodbri added

comment:4 by robe, 12 years ago

Component: tiger geocoderpagc_address_parser

comment:5 by robe, 12 years ago

This works okay with pagc_normalize

Except instead of 3rd, it returns: 3

Debating if that is okay or not. I'll have to see how geocoder handles it. I don't think it will care.

e.g.

select (a).address, a.predirabbrev, a.streetname from pagc_normalize_address(' 212 n 3rd ave, Minneapolis, mn 55401') As a ;

Yields:

 address | predirabbrev | streetname
---------+--------------+------------
     212 | N            | 3

comment:6 by robe, 12 years ago

Resolution: fixed
Status: assignedclosed

this works with pagc my other issue is a total unrelated and doesn't really belong here.

Note: See TracTickets for help on using tickets.