public final class GeoHash extends java.lang.Object implements java.lang.Comparable<GeoHash>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected long |
bits |
static long |
FIRST_BIT_FLAGGED |
protected byte |
significantBits |
| Modifier | Constructor and Description |
|---|---|
protected |
GeoHash() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOffBitToEnd() |
protected void |
addOnBitToEnd() |
int |
compareTo(GeoHash o) |
boolean |
contains(WGS84Point point)
find out if the given point lies within this hashes bounding box.
Note: this operation checks the bounding boxes coordinates, i.e. |
boolean |
enclosesCircleAroundPoint(WGS84Point point,
double radius) |
boolean |
equals(java.lang.Object obj) |
static GeoHash |
fromBinaryString(java.lang.String binaryString) |
static GeoHash |
fromGeohashString(java.lang.String geohash)
build a new
GeoHash from a base32-encoded String.This will also set up the hashes bounding box and other values, so it can also be used with functions like within(). |
static GeoHash |
fromLongValue(long hashVal,
int significantBits) |
static GeoHash |
fromOrd(long ord,
int significantBits) |
static java.lang.String |
geoHashStringWithCharacterPrecision(double latitude,
double longitude,
int numberOfCharacters)
This method uses the given number of characters as the desired precision
value.
|
GeoHash[] |
getAdjacent()
returns the 8 adjacent hashes for this one.
|
BoundingBox |
getBoundingBox() |
WGS84Point |
getBoundingBoxCenterPoint()
return the center of this
GeoHashs bounding box. |
int |
getCharacterPrecision()
Returns the number of characters that represent this hash.
|
GeoHash |
getEasternNeighbour() |
GeoHash |
getNorthernNeighbour() |
protected int[] |
getNumberOfLatLonBits() |
WGS84Point |
getPoint()
returns the
WGS84Point that was originally used to set up this.If it was built from a base32- String, this is the center point of
the bounding box. |
protected long[] |
getRightAlignedLatitudeBits() |
protected long[] |
getRightAlignedLongitudeBits() |
GeoHash |
getSouthernNeighbour() |
GeoHash |
getWesternNeighbour() |
int |
hashCode() |
long |
longValue() |
GeoHash |
next() |
GeoHash |
next(int step) |
long |
ord() |
GeoHash |
prev() |
protected GeoHash |
recombineLatLonBitsToHash(long[] latBits,
long[] lonBits) |
int |
significantBits()
how many significant bits are there in this
GeoHash? |
static long |
stepsBetween(GeoHash one,
GeoHash two)
Counts the number of geohashes contained between the two (ie how many
times next() is called to increment from one to two) This value depends
on the number of significant bits.
|
java.lang.String |
toBase32()
get the base32 string for this
GeoHash.this method only makes sense, if this hash has a multiple of 5 significant bits. |
java.lang.String |
toBinaryString() |
java.lang.String |
toString() |
static GeoHash |
withBitPrecision(double latitude,
double longitude,
int numberOfBits)
create a new
GeoHash with the given number of bits accuracy. |
static GeoHash |
withCharacterPrecision(double latitude,
double longitude,
int numberOfCharacters)
This method uses the given number of characters as the desired precision
value.
|
boolean |
within(GeoHash boundingBox)
returns true iff this is within the given geohash bounding box.
|
public static final long FIRST_BIT_FLAGGED
protected long bits
protected byte significantBits
public static GeoHash withCharacterPrecision(double latitude, double longitude, int numberOfCharacters)
public static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits)
GeoHash with the given number of bits accuracy. This
at the same time defines this hash's bounding box.public static GeoHash fromBinaryString(java.lang.String binaryString)
public static GeoHash fromGeohashString(java.lang.String geohash)
GeoHash from a base32-encoded String.public static GeoHash fromLongValue(long hashVal, int significantBits)
public static java.lang.String geoHashStringWithCharacterPrecision(double latitude,
double longitude,
int numberOfCharacters)
public GeoHash next(int step)
public GeoHash next()
public GeoHash prev()
public long ord()
public int getCharacterPrecision()
java.lang.IllegalStateException - when the hash cannot be encoded in base32, i.e. when the
precision is not a multiple of 5.public static GeoHash fromOrd(long ord, int significantBits)
public static long stepsBetween(GeoHash one, GeoHash two)
one - two - public GeoHash[] getAdjacent()
public int significantBits()
GeoHash?public long longValue()
public java.lang.String toBase32()
GeoHash.java.lang.IllegalStateException - when the number of significant bits is not a multiple of 5.public boolean within(GeoHash boundingBox)
public boolean contains(WGS84Point point)
GeoHashs special abilities.spublic WGS84Point getPoint()
WGS84Point that was originally used to set up this.String, this is the center point of
the bounding box.public WGS84Point getBoundingBoxCenterPoint()
GeoHashs bounding box. this is rarely
the same point that was used to build the hash.public BoundingBox getBoundingBox()
public boolean enclosesCircleAroundPoint(WGS84Point point, double radius)
protected GeoHash recombineLatLonBitsToHash(long[] latBits, long[] lonBits)
public GeoHash getNorthernNeighbour()
public GeoHash getSouthernNeighbour()
public GeoHash getEasternNeighbour()
public GeoHash getWesternNeighbour()
protected long[] getRightAlignedLatitudeBits()
protected long[] getRightAlignedLongitudeBits()
protected int[] getNumberOfLatLonBits()
protected final void addOnBitToEnd()
protected final void addOffBitToEnd()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toBinaryString()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2015. All Rights Reserved.