Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

PostgreSQL binding for libpostal

License

NotificationsYou must be signed in to change notification settings

pramsey/pgsql-postal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • PostgreSQL 9.4 and higher is required because of the JSONB support. Could reduce that by using ordinary JSON as a return type instead.
  • libpostal takes quite a lot of memory when intialized, and has a noticeable start-up time. When you first runpostal_normalize orpostal_parse there will be a delay while the library data first loads.
  • Backends withlibpostal active will be quite large in terms of memory usage (about 1Gb on my computer) so you probably want to take care about spawning too many of them at once.

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

  • postal_normalize(address TEXT) returnsTEXT[]
  • postal_parse(address TEXT) returnsJSONB

Installation

UNIX

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

Edit the paths toPOSTAL_INCLUDE andPOSTAL_LIBS in theMakefile to refer to yourlibpostal install location, and then run:

makemake install

Then in your databaseCREATE EXTENSION postal.

Windows

Sorry, no story here yet.

To Do

  • Perhaps allow normalization options other than the defaults.

About

PostgreSQL binding for libpostal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp