standardize_address — Returns an stdaddr form of an input address utilizing lex, gaz, and rule tables.
stdaddr standardize_address(text  lextab, text  gaztab, text  rultab, text  address);
stdaddr standardize_address(text  lextab, text  gaztab, text  rultab, text  micro, text  macro);
Returns an stdaddr form of an input address utilizing lex table table name, gaz table, and rules table table names and an address.
Variante 1: prende un indirizzo come una singola riga.
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.
Disponibilità: 2.2.0
            
 Questo metodo richiede l'estensione address_standardizer. 
Utilizzo dell'estensione address_standardizer_data_us
CREATE EXTENSION address_standardizer_data_us; -- only needs to be done once
Variante 1: indirizzo a riga singola. Non funziona bene con gli indirizzi non statunitensi.
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
Using tables packaged with tiger geocoder. This example only works if you installed postgis_tiger_geocoder.
SELECT *  FROM standardize_address('tiger.pagc_lex',
         'tiger.pagc_gaz', 'tiger.pagc_rules', 'One Devonshire Place, PH 301, Boston, MA 02109-1234');
        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') 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)
                        
        Variante 2: come indirizzo in due parti
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)
stdaddr, rules table, lex table, gaz table, Pagc_Normalize_Address