node package manager


Node.js C++ & JS-Native GeoHash

node-geohash-cpp is a C++ extension to node based on node-geohash.

npm install cgeohash
var geohash = require('cgeohash');
sys.puts(geohash.encode(37.8324, 112.5584)); // 'ww8p1r4t8'

var latlon = geohash.decode('ww8p1r4t8');

Encode a pair of latitude and longitude into geohash. The third argument is optional, you can specify a length of this hash string, which also affect on the precision of the geohash.

Decode a hash string into pair of latitude and longitude. A javascript object is returned with key latitude and longitude.

Find neighbor of a geohash string in certain direction. Direction is a two-element array, i.e. [1,0] means north, [-1,-1] means southwest.

Decode hashstring into a bound box matches it. Data returned in a four-element array: [minlat, minlon, maxlat, maxlon]

Check Wikipedia for more information.

Ruby on Rails is released under the MIT License.