@alexpavlov/geohash-js

1.3.1 • Public • Published

GeoHash

NPM Version Build status Coverage status Dependency Status devDependency Status GitHub license

Geohash is a public domain geocoding system invented by Gustavo Niemeyer, which encodes a geographic location into a short string of letters and digits. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.

Geohashes offer properties like arbitrary precision and the possibility of gradually removing characters from the end of the code to reduce its size (and gradually lose precision). As a consequence of the gradual precision degradation, nearby places will often (but not always) present similar prefixes. The longer a shared prefix is, the closer the two places are.

Read more on Wikipedia.

Usage

Standalone version

Include geohash.min.js which you can find in the build folder.

<script src="dist/geohash-js/geohash.min.js"></script>

Now you can use library

var hashedValue = geohash.encode(52.372518, 4.896977);

Usage as module

Installation

With npm

$ npm install @alexpavlov/geohash-js

or with yarn

$ yarn add @alexpavlov/geohash-js

Add to your module

CommonJS

var encode = require('@alexpavlov/geohash-js').encode;

var hashedValue = encode(52.372518, 4.896977);

ES2015

import { encode } from '@alexpavlov/geohash-js';

let hashedValue = encode(52.372518, 4.896977);

License

MIT

/@alexpavlov/geohash-js/

    Package Sidebar

    Install

    npm i @alexpavlov/geohash-js

    Weekly Downloads

    81

    Version

    1.3.1

    License

    MIT

    Unpacked Size

    41.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • alexpavlov