these-3-words/README.md

111 lines
3.0 KiB
Markdown
Raw Normal View History

2014-11-17 10:21:37 +00:00
These3Words
2014-11-16 21:31:11 +00:00
=============
Remember a location anywhere in the world with just three words.
2014-11-16 21:31:50 +00:00
2024-06-27 18:00:27 +00:00
Try it: X
Some interesting locations:
2024-06-27 18:00:27 +00:00
* [Battery Park, NYC](?)
* [Downtown San Francisco](?)
* [Sydney, Australia](?)
This app was inspired by http://what3words.com/
2014-11-17 00:03:10 +00:00
example
=======
>>> import thesethreewords as these
# the home of particle physics
>>> CERN = (46.232355, 6.055419)
>>> three = these.three_words(CERN)
>>> print three
'turks-yunnan-salant'
2014-11-17 00:03:10 +00:00
>>> these.decode(three)
(46.232335567474365, 6.055419445037842)
See where this is on [These3Words map][cernmap].
2014-11-17 00:03:10 +00:00
requirements
============
You need to install the [geohash][geohash] and [bottle][bottlepy]
libraries:
2014-11-17 00:03:10 +00:00
$ pip install geohash
$ pip install bottle
2014-11-17 00:03:10 +00:00
six words
=========
There are a lot of 3x3m squares on the earth's surface. To encode
them in only three words requires a long wordlist, as a result
some fairly obscure words get on it. If you can live with
having to remember six words the wordlist is much shorter.
The six word wordlist comes from the amazing [humanhash][humanhash]
library. Words were chosen to maximise clarity in human
2014-11-17 00:06:19 +00:00
communication, they should be more familiar than the words
on the three wordlist:
2014-11-17 00:03:10 +00:00
>>> six = these.six_words(CERN)
>>> print six
'spaghetti-carolina-kentucky-oscar-iowa-table'
>>> these.decode(six)
(46.232335567474365, 6.055419445037842)
how it works
============
Each latitude/longitude pair is converted to a nine
character geohash. This provides about 3meter
resolution at all latitudes. The geohash is then
converted to an integer which is encoded as a string
of words.
The wordlist used to encode the `geohash` into just
three words uses your local computers dictionary. Some
attempts are made to remove really obscure words but
it could be better. You need to use the same wordlist
when encoding and decoding a `these-3-words` hash.
The `these-3-words` hash shares the
property of a `geohash` that nearby locations share
have similar `these-3-words` hashes
>>> other_CERN_site = (46.256811, 6.056792)
>>> six = these.six_words(other_CERN_site)
>>> print six
'spaghetti-carolina-kentucky-utah-seventeen-neptune'
2014-11-17 00:03:10 +00:00
>>> these.decode(six)
(46.256797313690186, 6.056792736053467)
The other CERN site is [here][othercernmap] on a map.
2014-11-17 00:03:10 +00:00
webservice
==========
The file `server.py` provides a tiny webservice that allows to display a
location given by three words on a Google Maps map.
The server requires [bottle.py][bottlepy] to be installed. It can be run
locally by typing `./server.py` or `python server.py` respectively.
brought to you by [@betatim][betatim] and [@kdungs][kdungs] productions
2014-11-17 00:03:10 +00:00
[humanhash]: https://github.com/zacharyvoase/humanhash
[geohash]: https://code.google.com/p/python-geohash/
[cernmap]: http://these3words.herokuapp.com/turks-yunnan-salant
[othercernmap]: http://these3words.herokuapp.com/spaghetti-carolina-kentucky-utah-seventeen-neptune
[bottlepy]: http://bottlepy.org/
2014-11-17 00:06:19 +00:00
[betatim]: https://twitter.com/betatim
[kdungs]: https://twitter.com/kdungs