|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.javadocmd.simplelatlng.Geohasher
public class Geohasher
Implements the Geohash algorithm for hashing latitude and longitude points. Note: this implementation is only "stable" with 12-character hashes. Decoding "s" and re-hashing the result yields "t40000000000". Decoding and re-hashing "t40000000000" yields the same. 12 characters was chosen because this gives us precision up to one-millionth of a degree, like the rest of this library.
| Field Summary | |
|---|---|
static int |
PRECISION
Number of hash characters supported. |
| Constructor Summary | |
|---|---|
Geohasher()
|
|
| Method Summary | |
|---|---|
static LatLng |
decode(String hash)
Decodes a geohash string to its LatLng equivalent. |
static String |
hash(LatLng point)
Geohashes a latitude and longitude. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PRECISION
Number of hash characters supported.
Translates to binary bits per value by the formula:
BITS = ((PRECISION * 5) / 2) + PRECISION % 2.
BITS in turn translates to numerical precision
by the formula:
LATITUDE_ERROR = 90.0 / (2 ^ (BITS + 1))
LONGITUDE_ERROR = 180.0 / (2 ^ (BITS + 1))
| Constructor Detail |
|---|
public Geohasher()
| Method Detail |
|---|
public static LatLng decode(String hash)
hash - the geohash string of any precision, although LatLng will
still not become more precise than its settings.
public static String hash(LatLng point)
point - the point to hash.
PRECISION.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||