Opened 2 years ago

Last modified 17 months ago

#5160 new defect

standard_address and parse_address stuff USA when country is provided

Reported by: robe Owned by: robe
Priority: medium Milestone: PostGIS 3.5.0
Component: pagc_address_parser Version: 3.2.x
Keywords: Cc:

Description

Observe:

SELECT city, country
FROM parse_address('55 Laurier Avenue East, Room 3156, Ottawa ON K1N 6N5');

outputs:

city  | country
--------+---------
 Ottawa | CA

But if I add country

SELECT city, country
FROM parse_address('55 Laurier Avenue East, Room 3156, Ottawa ON K1N 6N5 Canada');

outputs:

 city           | country
--------------------------+---------
 Ottawa ON K1N 6N5 Canada | US

Similar if I do United States or US for US addresses, the country bit confuses it.

For standardize_address, might be caused by issue in parse_address:

-- works great

CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;
SELECT * 
FROM json_each_text( to_json ( standardize_address(
    'us_lex',
    'us_gaz', 
    'us_rules', 
    '55 Laurier Avenue East, Room 3156, Ottawa, ON K1N 6N5')
                              ) );

Results are very good:

   key     |   value
------------+-----------
 building   |
 house_num  | 55
 predir     |
 qual       |
 pretype    |
 name       | LAURIER
 suftype    | AVENUE
 sufdir     | EAST
 ruralroute |
 extra      |
 city       | OTTAWA
 state      | ONTARIO
 country    | CANADA
 postcode   | K1N 6N5
 box        |
 unit       | ROOM 3156

But add Canada and the whole thing falls apart:

CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;
SELECT * 
FROM json_each_text( to_json ( standardize_address(
    'us_lex',
    'us_gaz', 
    'us_rules', 
    '55 Laurier Avenue East, Room 3156, Ottawa, ON K1N 6N5 Canada')
                              ) );
    key     |      value
------------+------------------
 building   |
 house_num  | 55
 predir     |
 qual       |
 pretype    |
 name       | LAURIER
 suftype    | AVENUE
 sufdir     | EAST
 ruralroute |
 extra      |
 city       |
 state      | ONTARIO
 country    | CANADA USA
 postcode   | K1N 6N5
 box        |
 unit       | ROOM 3156 OTTAWA
(16 rows)

Change History (3)

comment:1 by robe, 2 years ago

Milestone: PostGIS 3.2.2PostGIS 3.2.3

comment:2 by robe, 2 years ago

Milestone: PostGIS 3.2.3PostGIS 3.4.0

comment:3 by robe, 17 months ago

Milestone: PostGIS 3.4.0PostGIS 3.5.0

I'll push back if I get to it before then.

Note: See TracTickets for help on using tickets.