Go library and command-line tool

Install the library with go get.

$ go get whatfreewords.org/whatfreewords-go

Or download whatfreewords-go.tar.gz and extract it to the right place in your GOPATH.

The library, command-line tool, and API server are all published under the Creative Commons CC0 license.

Library usage

If you installed the library with go get, it will already be in the right place. If you downloaded whatfreewords-go.tar.gz then you will probably have to extract it so that the library source files are in ~/go/src/whatfreewords.org/whatfreewords-go/*.go.

import "whatfreewords.org/whatfreewords-go"


words, err := whatfreewords.LatLon2Words(37.234332, -115.806657)
lat, lon, err := whatfreewords.Words2LatLon("joyful.nail.harmonica")
fmt.Printf("%.6f %.6f\n", lat, lon)

There is a small example program in example/main.go.

LatLon2Words and Words2LatLon are the only functions considered part of the API, but you are welcome to use the other exported functions if you find them useful.

Command-line tool usage

In cmd/whatfreewords/ is a small tool to do What3Words geocoding conversion on the command-line.

Help text is as follows:

usage: whatfreewords [-i] [INPUT...]

  -i    read from stdin

If not -i, you should specify at least one INPUT in the form lat,lon or words. It is perfectly acceptable to mix lat,lon and word inputs in a single invocation.

    whatfreewords -i < words.txt
    whatfreewords joyful.nail.harmonica
    whatfreewords 37.234332,-115.806657

Output is of the form "INPUT[tab]OUTPUT" with one line per INPUT, where OUTPUT will be either the converted INPUT, or an error message.

API server

In cmd/whatfreewordsd/ is a small program that listens on port 8081 and provides an API server to do What3Words geocoding conversion.

For more information see the web API page.