Skip to content

Convert earth coordinates into user-friendly four words

Notifications You must be signed in to change notification settings

AliFlux/open-geo-words

Repository files navigation

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/open-geo-words@1.0.6/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.

Stay in touch

For latest releases and announcements, check out my site: aliashraf.me

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

About

Convert earth coordinates into user-friendly four words

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published