UNPKG

gthash

Version:

Geotemporal hashing function based on geohash and z-order curves. The resulting string hash encodes time and space on Earth with variable precision and all other characteristics of a geohash. Comes with Typescript definitions

64 lines (44 loc) 1.69 kB
![Logo](https://i.imgur.com/0LJfZz3.png) **G**eo**T**emporal hashing algorithm based on z-order curves. A time based extension to the popular [geohash](http://geohash.org/). Typescript 💙 [![Build Status](https://travis-ci.com/ChrisChares/gthash.svg?branch=master)](https://travis-ci.com/ChrisChares/gthash) [![Coverage Status](https://coveralls.io/repos/github/ChrisChares/gthash/badge.svg?branch=master)](https://coveralls.io/github/ChrisChares/gthash?branch=master) ![npm](https://img.shields.io/npm/v/gthash.svg) ![npm](https://img.shields.io/npm/dw/gthash.svg) ### Installation This is a [node](https://nodejs.org/en/) module available though [the npm registry](https://www.npmjs.com/package/gthash) Installation is done via `npm` or `yarn` ```bash $ npm install gthash --save # OR $ yarn add geohash ``` ### Getting Started ```typescript import { encodeHash, decodeHash } from 'gthash'; // Apollo 11 launch - July 16th 1969, Cape Canaveral, FL const hash = encodeHash({ latitude: 28.5620, longitude: -80.57721, timestamp: -14601600 }); console.log(hash); // IykrGTkfLT8LBzonFg4qMhkjKBsHBAEj // Woodstock Music & Art Fair begins - August 15th, Wallkill, New York const hash2 = encodeHash({ latitude: 41.477525, longitude: -74.36358, timestamp: -12009600 }); console.log(hash2); // Iy05Oy0vPx05CAIGMhI7AykoCiERMSkx ``` Note how hashes of events that are similar in time and space share a similar prefix. ### Features + Variable precision + Places that are similar in space and time will share a similar prefix + Typescript definitions + 100% test coverage ### Contributing Please do! + Performance + Documentation + Hash length + Code coverage