Home

Awesome

PostgreSQL Postal Address Normalizer

Motivation

Libpostal is a C library for parsing/normalizing street addresses around the world. Having that functionality directly in PostgreSQL could potentially be useful.

This extension is for that.

Usage Notes

Examples

=# SELECT unnest(postal_normalize('412 first ave, victoria, bc'));

                  unnest                  
------------------------------------------
 412 1st avenue victoria british columbia
 412 1st avenue victoria bc
(2 rows)


=# SELECT postal_parse('412 first ave, victoria, bc');

                                  postal_parse                                   
---------------------------------------------------------------------------------
 {"city": "victoria", "road": "first ave", "state": "bc", "house_number": "412"}
(1 row)

Functions

Installation

UNIX

If you have PostgreSQL devel packages and CURL devel packages installed, you should have pg_config on your path. Confirm by running which pg_config.

Edit the paths to POSTAL_INCLUDE and POSTAL_LIBS in the Makefile to refer to your libpostal install location, and then run:

make
make install

Then in your database CREATE EXTENSION postal.

Windows

Sorry, no story here yet.

To Do