gthash
v0.1.2
Published
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
Downloads
2
Maintainers
Readme
GeoTemporal hashing algorithm based on z-order curves. A time based extension to the popular geohash. Typescript 💙
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