gthash
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Logo

GeoTemporal hashing algorithm based on z-order curves. A time based extension to the popular geohash. Typescript 💙

Build Status Coverage Status npm npm

Installation

This is a node module available though the npm registry

Installation is done via npm or yarn

$ npm install gthash --save
 
# OR 
 
$ yarn add geohash
 

Getting Started

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

Package Sidebar

Install

npm i gthash

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

127 kB

Total Files

8

Last publish

Collaborators

  • chrischares