Skip to content

Go tools for working with libpostal (sometimes in the service of Who's On First)

License

Notifications You must be signed in to change notification settings

nominalnz/whosonfirst-libpostal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-whosonfirst-libpostal

Go tools for working with libpostal (sometimes in the service of Who's On First)

Install

Make sure you have Go and libpostal installed. Then

make bin

wof-libpostal-server

$> ./bin/wof-libpostal-server -options

Usage of wof-libpostal-server:
  -gracehttp.log
	Enable logging. (default true)
  -host string
    	The hostname to listen for requests on (default "localhost")
  -port int
    	The port number to listen for requests on (default 8080)

Note you will need to install the underlying libpostal C library yourself in order for wof-libpostal-server to work.

wof-libpostal-server exposes the following endpoints:

Endpoints

GET /expand ?address=ADDRESS

This endpoint accepts a single address parameter and expands it into one or more normalized forms suitable for geocoder queries.

curl -s -X GET 'http://localhost:8080/expand?address=475+Sansome+St+San+Francisco+CA' | python -mjson.tool
[
    "475 sansome saint san francisco california",
    "475 sansome saint san francisco ca",
    "475 sansome street san francisco california",
    "475 sansome street san francisco ca"
]

GET /parse ?address=ADDRESS

This endpoint accepts a single address parameter and parses it in to its components.

curl -s -X GET 'http://localhost:8080/parse?address=475+Sansome+St+San+Francisco+CA' | python -mjson.tool
[
    {
        "label": "house_number",
        "value": "475"
    },
    {
        "label": "road",
        "value": "sansome st"
    },
    {
        "label": "city",
        "value": "san francisco"
    },
    {
        "label": "state",
        "value": "ca"
    }
]

See also

About

Go tools for working with libpostal (sometimes in the service of Who's On First)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 79.2%
  • Makefile 11.4%
  • Dockerfile 9.4%