Geohash Class Reference
Public Member Functions | |
| Geohash () | |
| decode ($hash) | |
| encode ($lat, $long) | |
Private Member Functions | |
| calcError ($bits, $min, $max) | |
| precision ($number) | |
| binEncode ($number, $min, $max, $bitcount) | |
| binDecode ($binary, $min, $max) | |
Private Attributes | |
| $coding = "0123456789bcdefghjkmnpqrstuvwxyz" | |
| $codingMap = array() | |
Detailed Description
Geohash generation class http://blog.dixo.net/downloads/
This file copyright (C) 2008 Paul Dixon (paul@elphin.com)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Encode and decode geohashes
Definition at line 29 of file geohash.php.
Member Function Documentation
| binDecode | ( | $ | binary, | |
| $ | min, | |||
| $ | max | |||
| ) | [private] |
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
Definition at line 222 of file geohash.php.
Referenced by decode().
| binEncode | ( | $ | number, | |
| $ | min, | |||
| $ | max, | |||
| $ | bitcount | |||
| ) | [private] |
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
Definition at line 201 of file geohash.php.
Referenced by encode().
| calcError | ( | $ | bits, | |
| $ | min, | |||
| $ | max | |||
| ) | [private] |
What's the maximum error for $bits bits covering a range $min to $max
Definition at line 170 of file geohash.php.
Referenced by decode().
| decode | ( | $ | hash | ) |
Decode a geohash and return an array with decimal lat,long in it
Definition at line 47 of file geohash.php.
References binDecode(), and calcError().

| encode | ( | $ | lat, | |
| $ | long | |||
| ) |
Encode a hash from given lat and long
Definition at line 94 of file geohash.php.
References binEncode(), and precision().

| Geohash | ( | ) |
Definition at line 34 of file geohash.php.
| precision | ( | $ | number | ) | [private] |
Definition at line 184 of file geohash.php.
Referenced by encode().
Field Documentation
$coding = "0123456789bcdefghjkmnpqrstuvwxyz" [private] |
Definition at line 31 of file geohash.php.
$codingMap = array() [private] |
Definition at line 32 of file geohash.php.
The documentation for this class was generated from the following file:
