Skip to content
C++ Implementation of Node-GeoHash
C++ JavaScript Python
Latest commit bf1bde8 Jul 25, 2013 @gnagel Added "encode_the_world" method for bulk testing geohash; added sampl…
…e CSV output with precision=12,decimal=2; and bumped version number
Failed to load latest commit information.
bin Added "encode_the_world" method for bulk testing geohash; added sampl… Jul 25, 2013
includes/cvv8 Updating the layout of the package, added test for seconds_per_call_x… Jun 22, 2013
src
tests Minor updates to speed tests Jul 23, 2013
.gitignore Updated for speed tests Jul 16, 2013
README.md Updated readme Jun 21, 2013
binding.gyp Updated for speed tests Jul 16, 2013
encode_the_world.csv Added "encode_the_world" method for bulk testing geohash; added sampl… Jul 25, 2013
index.js
index_speed_tests.js Updated for speed tests Jul 16, 2013
package.json Added "encode_the_world" method for bulk testing geohash; added sampl… Jul 25, 2013

README.md

Welcome to node-geohash-cpp

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

Install

npm install cgeohash

Usage

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

var latlon = geohash.decode('ww8p1r4t8');
sys.puts(latlon.latitude);
sys.puts(latlon.longitude);

encode (latitude, longitude, precision=9)

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 (hashstring)

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

neighbor (hashstring, direction)

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_bbox (hashstring)

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

About Geohash

Check Wikipedia for more information.

License

Ruby on Rails is released under the MIT License.

Something went wrong with that request. Please try again.