-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathREADME
59 lines (37 loc) · 1.27 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
=======================================================================
INSTALL
=======================================================================
Copy all files under 'Classes/ARC' or 'Classes/NonARC' directory into your project.
=======================================================================
USAGE
=======================================================================
#import "GeoHash.h"
/* Get GetHash by latitude, longitude, and hash-length */
NSString *hash = [GeoHash hashForLatitude:35.6894875
longitude:139.6917064
length:13];
/* hash equals to @"xn774c06kdtve" */
/* Decode GeoHash and get an area which the hash indicates */
GHArea *area = [GeoHash areaForHash:@"c216ne"];
area.latitude.max
area.latitude.min
area.longitude.max
area.longitude.min
/* Adjacent */
NSString *adjacentHash = [GeoHash adjacentForHash:@"dqcjq"
direction:GHDirectionNorth];
/* @"dqcjw" */
GHNeighbors *neighbors = [GeoHash neighborsForHash:@"dqcw5"];
neighbors.north
neighbors.south
neighbors.east
neighbors.west
neighbors.northEast
neighbors.northWest
neighbors.southEast
neighbors.southWest
/* check invalid hash */
if (![GeoHash verifyHash:@"abw!@"])
{
...
}