[postgis-tickets] [PostGIS] #5160: standard_address and parse_address stuff USA when country is provided
PostGIS
trac at osgeo.org
Mon May 23 12:14:47 PDT 2022
#5160: standard_address and parse_address stuff USA when country is provided
---------------------------------+---------------------------
Reporter: robe | Owner: robe
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.2.2
Component: pagc_address_parser | Version: 3.2.x
Keywords: |
---------------------------------+---------------------------
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)
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5160>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list