Skip to content
generate an array of geohashes that completely contain a polygon
JavaScript Shell
Latest commit b01f726 Jul 9, 2012 @substack draw the hash boundaries
Failed to load latest commit information.
example draw the hash boundaries Jul 9, 2012
test add a test just using the hash example for regression purposes Jul 8, 2012
.travis.yml using travis Jul 8, 2012
LICENSE
README.markdown using travis Jul 9, 2012
index.js remove unnecessary extents lib file Jul 8, 2012
package.json s/circumscribe/completely contain/g Jul 8, 2012

README.markdown

polyhash

Generate an array of geohashes that completely contains a polygon.

build status

example

var polyhash = require('polyhash');
var polygon = [
    [ 37.96, -122.45 ],
    [ 37.95, -122.90 ],
    [ 38.21, -122.62 ]
];
var hashes = polyhash(polygon, 4);
console.dir(hashes);

[ '9q8x', '9q8z', '9qb8', '9qbb' ]

methods

var polyhash = require('polyhash')

polyhash(polygon, level)

Return an array of geohashes that completely contains the array of points described by polygon.

Points are of the form [ lat, lon ].

The level provided is the maximum hash resolution which is also the maximum string length of the geohash entries.

At the maximum geohash resolution level, hashes that are partially intersected will be counted. All other levels recurse down to sublevels until a completely contained hash is found.

install

With npm do:

npm install polyhash

license

MIT

Something went wrong with that request. Please try again.