open-geo-words
v1.0.6
Published
Convert coordinates into user-friendly three words
Downloads
2
Maintainers
Readme
Open Geo Words
Convert coordinates into user-friendly three words
Inspired by what3words. This standalone js library converts coordinates into three words that are easier to read, write, and communicate with. Essentially, each 3m block in the whole world is mapped to a set of words.
Conversion example
var lonlat = [73.1132, 33.5321];
var result = OpenGeoWords.generateWordsString(lonlat)
///blower.endurance.napier
Reverse convert example
var words = "///blower.endurance.napier"
var result = OpenGeoWords.parseWordsString(lonlat)
// [73.1132, 33.5321]
Explore the examples directory for demos that you can run on your browser.
Install via npm
npm install open-geo-words
And then in your browser code:
import { OpenGeoWords } from "open-geo-words";
Or in your Node.js code:
var { OpenGeoWords } = require("open-geo-words");
Install via <script>
tag from CDN
<script src="https://unpkg.com/[email protected]/dist/open-geo-words.js"></script>
And then in your code:
var OpenGeoWords = new window["open-geo-words"].OpenGeoWords;
Purpose
What3words is pretty amazing, but it only works as an online API. In GIS and mapping domain, there is an increasing demand for offline systems so I decided to write this tiny script in a couple of hours to provide an alternative.
Limitations
~~Currently a four words string is generated instead of three. That is because the words list I am using only has about 8000 words. I am looking for a list of about 60k words to properly map the world in three words. The list must only contain most frequent words in simple english, without any profanity and complications. If you find such a list, please let me know.~~
Three words are now supported. The dictionary of about 60k words is built in, and heavily compressed to speed up the page load.
Stay in touch
For latest releases and announcements, check out my site: aliashraf.net
License
This software is released under the MIT License. Please read LICENSE for information on the software availability and distribution.
Copyright (c) 2022 Ali Ashraf