From: Regina Obe Date: Mon, 4 Jan 2016 19:52:21 +0000 (+0000) Subject: Provide example of micro/macro variant address_standardizer X-Git-Tag: 2.3.0beta1~301 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=802636255189fe6c98b6f8ff50cb723280bbaba4;p=postgis Provide example of micro/macro variant address_standardizer Closes #3353 for 2.3 git-svn-id: http://svn.osgeo.org/postgis/trunk@14548 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/extras_address_standardizer.xml b/doc/extras_address_standardizer.xml index 9a8d62595..3fffec309 100644 --- a/doc/extras_address_standardizer.xml +++ b/doc/extras_address_standardizer.xml @@ -645,6 +645,9 @@ into includes in the future for easier maintenance. Description Returns an form of an input address utilizing table name, , and table names and an address. + + Variant 1: Takes an address as a single line. + Variant 2: Takes an address as 2 parts. A micro consisting of standard first line of postal address e.g. house_num street, and a macro consisting of standard postal second line of an address e.g city, state postal_code country. Availability: 2.2.0 @@ -655,9 +658,11 @@ into includes in the future for easier maintenance. Examples Using address_standardizer_data_us extension - CREATE EXTENSION address_standardizer_data_us; -- only needs to be done once -SELECT house_num, name, suftype, city, country, state, unit FROM standardize_address('us_lex', - 'us_gaz', 'us_rules', 'One Devonshire Place, PH 301, Boston, MA 02109-1234'); + CREATE EXTENSION address_standardizer_data_us; -- only needs to be done once + +Variant 1: Single line address. This doesn't work well with non-US addresses +SELECT house_num, name, suftype, city, country, state, unit FROM standardize_address('us_lex', + 'us_gaz', 'us_rules', 'One Devonshire Place, PH 301, Boston, MA 02109'); house_num | name | suftype | city | country | state | unit ----------+------------+---------+--------+---------+---------------+----------------- 1 | DEVONSHIRE | PLACE | BOSTON | USA | MASSACHUSETTS | # PENTHOUSE 301 @@ -668,7 +673,7 @@ SELECT house_num, name, suftype, city, country, state, unit FROM standardize_ad Make easier to read we'll dump output using hstore extension CREATE EXTENSION hstore; you need to install SELECT (each(hstore(p))).* FROM standardize_address('tiger.pagc_lex', 'tiger.pagc_gaz', - 'tiger.pagc_rules', 'One Devonshire Place, PH 301, Boston, MA 02109-1234') As p; + 'tiger.pagc_rules', 'One Devonshire Place, PH 301, Boston, MA 02109') As p; key | value ------------+----------------- box | @@ -689,6 +694,31 @@ SELECT house_num, name, suftype, city, country, state, unit FROM standardize_ad ruralroute | (16 rows) + +Variant 2: As a two part Address +SELECT (each(hstore(p))).* + FROM standardize_address('tiger.pagc_lex', 'tiger.pagc_gaz', + 'tiger.pagc_rules', 'One Devonshire Place, PH 301', 'Boston, MA 02109, US') As p; + key | value +------------+----------------- + box | + city | BOSTON + name | DEVONSHIRE + qual | + unit | # PENTHOUSE 301 + extra | + state | MA + predir | + sufdir | + country | USA + pretype | + suftype | PL + building | + postcode | 02109 + house_num | 1 + ruralroute | +(16 rows) +