Skip to content

whosonfirst/go-whosonfirst-libpostal

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cmd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published