Skip to content
GeoHash C Library
C Perl CMake Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
debian add support for debian packaging Jul 23, 2013
include/geohash Improved directory layout and cmake build script Jul 23, 2013
scripts first commit Dec 27, 2011
src add install destinations, fix cmake errors Aug 13, 2015
tests Improved directory layout and cmake build script Jul 23, 2013
.gitignore
CMakeLists.txt Improved directory layout and cmake build script Jul 23, 2013
LICENSE first commit Dec 27, 2011
README remove typo on README Jul 24, 2013
cmake_uninstall.cmake.in Improved directory layout and cmake build script Jul 23, 2013
package.sh add support for debian packaging Jul 23, 2013

README

=======================================================================
 INSTALL
=======================================================================

 1. cd build
 2. cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release

 parameters
    - BUILD_SHARED_LIBS (ON|OFF)
    - CMAKE_BUILD_TYPE (Debug|Release)
    - CMAKE_INSTALL_PREFIX (/usr/local)

3. make
4. make test
5. make install


Or just simply,

perl ./scripts/install

=======================================================================
 USAGE
=======================================================================

#include <geohash.h>

/* Get Hash */
char *hash;
hash = GEOHASH_encode(latitude, longitude, length);
...
free(hash);


/* Get Area by Hash */
GEOHASH_area *area;
area = GEOHASH_decode("dqcw5");

/* You can get the range of both latitude and longitude

area->latitude.max;
area->latitude.min;
area->longitude.max;
area->longitude.min;

*/
GEOHASH_free_area(area);


/* Get Adjacent Hash by Origin's Hash and Direction*/
char *adjacent_hash;
/* You can choose direction from GEOHASH_NORTH, GEOHASH_SOUTH, GEOHASH_EAST, and GEOHASH_WEST */
adjacent_hash = GEOHASH_get_adjacent("dqcw5", GEOHASH_NORTH);
...
free(adjacent_hash);



/* Get Neighbors' Hash by Origin's Hash */
GEOHASH *neighbors;
neighbors = GEOHASH_get_neighbors("dqcw5");

/* You can get hashes of each direction's neighbor
neighbors->north;
neighbors->north_east;
neighbors->north_west;
neighbors->south;
neighbors->south_east;
neighbors->south_west;
neighbors->east;
neighbors->west;
*/
GEOHASH_free_neighbors(neighbors);
You can’t perform that action at this time.