PHP Class Geohash, UK-Postcodes

Author: Keisuke SATO
Show file Open project: pezholio/UK-Postcodes Class Usage Examples

Public Methods

Method Description
Geohash ( )
decode ( $hash ) Decode a geohash and return an array with decimal lat,long in it
encode ( $lat, $long ) Encode a hash from given lat and long

Private Methods

Method Description
binDecode ( $binary, $min, $max ) decodes binary encoding of number as detailed in http://en.wikipedia.org/wiki/Geohash#Example removing the tail recursion is left an exercise for the reader
binEncode ( $number, $min, $max, $bitcount ) create binary encoding of number as detailed in http://en.wikipedia.org/wiki/Geohash#Example removing the tail recursion is left an exercise for the reader
calcError ( $bits, $min, $max ) What's the maximum error for $bits bits covering a range $min to $max
precision ( $number ) * returns precision of number precision of 42 is 0.5 precision of 42.4 is 0.05 precision of 42.41 is 0.005 etc

Method Details

Geohash() public method

public Geohash ( )

decode() public method

Decode a geohash and return an array with decimal lat,long in it
public decode ( $hash )

encode() public method

Encode a hash from given lat and long
public encode ( $lat, $long )