Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lyokato/libgeohash
GeoHash C Library
https://github.com/lyokato/libgeohash
Last synced: 18 days ago
JSON representation
GeoHash C Library
- Host: GitHub
- URL: https://github.com/lyokato/libgeohash
- Owner: lyokato
- License: mit
- Created: 2011-12-27T13:22:30.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-04-22T08:49:34.000Z (over 4 years ago)
- Last Synced: 2024-07-31T22:56:19.518Z (3 months ago)
- Language: C
- Homepage:
- Size: 182 KB
- Stars: 32
- Watchers: 7
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
=======================================================================
INSTALL
=======================================================================1. cd build
2. cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Releaseparameters
- BUILD_SHARED_LIBS (ON|OFF)
- CMAKE_BUILD_TYPE (Debug|Release)
- CMAKE_INSTALL_PREFIX (/usr/local)3. make
4. make test
5. make installOr just simply,
perl ./scripts/install
=======================================================================
USAGE
=======================================================================#include
/* 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);