forked from lyokato/libgeohash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
73 lines (53 loc) · 1.54 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
=======================================================================
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);