maximveksler / objc-geohash

Objective-C GeoHash Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

=======================================================================
 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!@"])
{
    ...
}





About

Objective-C GeoHash Library

License:MIT License


Languages

Language:Objective-C 93.4%Language:C 6.1%Language:Ruby 0.5%