geohash-compression

Simple geohash compressing function

Usage no npm install needed!

<script type="module">
  import geohashCompression from 'https://cdn.skypack.dev/geohash-compression';
</script>

README

geohash-compression

Compressing string array of geohash

Example

const fs = require('fs');
const compressGeohashes = require('geohash-compression');

const hashes = JSON.parse(fs.readFileSync('./data.json'));

const compressedHashes = compressGeohashes(hashes);
console.log(`Uncompressed length: ${hashes.length}`);
console.log(`Compressed length: ${compressedHashes.length}`);

Result

Uncompressed length: 26953
Compressed length: 2339

data.json

["ezpgwfut","ezpgwfuv","ezpgwfvj","ezpgwfvm","ezpgwfvt","ezpgwfvv","ezpgwfyj","ezpgwfgh","ezpgwfgk","ezpgwfgs","ezpgwfgu","ezpgwfuh","ezpgwfuk","ezpgwfus","ezpgwfuu","ezpgwfvh","ezpgwfvk","ezpgwfvs","ezpgwfvu","ezpgwfyh","ezpgwfyk","ezpgwfys","ezpgwffg",...,"ezpgquns","ezpgqunu","ezpgquph","ezpgqupk","ezpgqups","ezpgqupu","ezpgqup7"]