跳转到主要内容

address_standardizer

Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.

postgis : Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.

Overview

ID Extension Package Version Category License Language
1505 address_standardizer postgis 3.6.4 GIS GPL-2.0 C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r No Yes No Yes yes no

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PGDG 3.6.4 18 17 16 15 14 postgis -
RPM PGDG 3.6.3 18 17 16 15 14 postgis36_$v -
DEB PGDG 3.6.4 18 17 16 15 14 postgresql-$v-postgis-3 -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
el8.aarch64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
el9.x86_64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
el9.aarch64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
el10.x86_64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
el10.aarch64 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3 PGDG 3.6.3
d12.x86_64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
d12.aarch64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
d13.x86_64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
d13.aarch64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u22.x86_64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u22.aarch64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u24.x86_64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u24.aarch64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u26.x86_64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4
u26.aarch64 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4 PGDG 3.6.4

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install postgis;		# install via package name, for the active PG version
pig install address_standardizer;		# install by extension name, for the current active PG version

pig install address_standardizer -v 18;   # install for PG 18
pig install address_standardizer -v 17;   # install for PG 17
pig install address_standardizer -v 16;   # install for PG 16
pig install address_standardizer -v 15;   # install for PG 15
pig install address_standardizer -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION address_standardizer;

Usage

Address Standardizer: Address parsing and standardization for PostGIS

The Address Standardizer is a PostGIS extension that parses a single-line address string into a structured form using configurable lexicon, grammar, and rules tables. It is a more flexible alternative to the built-in normalize_address function in the TIGER geocoder.

Setup

CREATE EXTENSION address_standardizer;

Standardizing Addresses

The core function takes an address string and three table references (lex, gaz, rules):

SELECT *
FROM standardize_address(
    'us_lex',        -- lexicon table
    'us_gaz',        -- gazetteer table
    'us_rules',      -- rules table
    '1600 Pennsylvania Ave NW, Washington, DC 20500'
);

The result contains structured fields:

Field Description
building Building name or identifier
house_num Street number
predir Prefix direction (N, S, E, W)
qual Qualifier
pretype Prefix type
name Street name
suftype Suffix type (St, Ave, Blvd)
sufdir Suffix direction
ruralroute Rural route
extra Extra information
city City name
state State
country Country
postcode ZIP/postal code
box PO Box
unit Unit/apartment number

Lexicon, Gazetteer, and Rules Tables

The standardizer is driven by three user-configurable tables:

Lexicon (lex) – Maps input tokens to standardized forms and token classes:

CREATE TABLE us_lex (
    id serial PRIMARY KEY,
    seq integer,
    word text,
    stdword text,
    token integer
);

Gazetteer (gaz) – Maps place names (cities, states) to standard forms:

CREATE TABLE us_gaz (
    id serial PRIMARY KEY,
    seq integer,
    word text,
    stdword text,
    token integer
);

Rules (rules) – Defines grammar rules for parsing addresses:

CREATE TABLE us_rules (
    id serial PRIMARY KEY,
    rule text
);

For US addresses, the address_standardizer_data_us extension provides pre-built data for these tables.