public class GeoHash
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
base32 |
Constructor and Description |
---|
GeoHash() |
GeoHash(double longitude,
double latitude,
int hashLength) |
Modifier and Type | Method and Description |
---|---|
static double[] |
asMer(java.lang.String geohash)
Finds the mer corresponding to a geohash
|
static long |
decimalValue(java.lang.String ghString)
Computes the numeric value of a geohash string
|
static GeoHash |
geohash(double longitude,
double latitude,
int hashLength)
GeoHash from longitude, latitude with number of characters = hashLength
|
static GeoHash |
geohash(long value,
int hashLength)
GeoHash corresponding to the long value
|
static GeoHash |
geohash(java.lang.String bitString)
GeoHash from a bit string
the length of the string must be a multiple of 5
|
static int[] |
geohashBits(double longitude,
double latitude,
int numBits) |
static GeoHash |
geohashFromString(java.lang.String base32String)
GeoHash from a string (base 32)
|
java.lang.String |
geohashString(double longitude,
double latitude,
int hashLength) |
static GeoHash |
geohashWithBitsLength(double longitude,
double latitude,
int numberOfBits)
GeoHash from longitude, latitude with number of bits = numberOfBits
numberOfBits must be a multiple of 5
|
JPoint2DD |
getCenterPoint()
Computes the center point of the geohash mer
|
long |
getDecimalValue()
Getter for the numeric value of the geohash
|
GeoHash[] |
getEightNeighbors()
Finds the eight neighbors of this
|
java.lang.String |
getGeoHashString()
Getter for geohash string
|
GeoHash |
getGeoHashToTheEast()
Finds the geohash to the east of this.
|
GeoHash |
getGeoHashToTheNorth()
Finds the geohash to the north of this.
|
GeoHash |
getGeoHashToTheSouth()
Finds the geohash to the south of this
|
GeoHash |
getGeoHashToTheWest()
Finds the geohash to the west of this
|
double[] |
getMer()
Getter for mer
|
short |
getNumberOfBits()
Getter for the number of bits in the geohash bit string
|
long |
getValue() |
GeoHash |
next()
Finds the next geohash.
|
GeoHash |
next(int numberOfSteps)
Finds the geohash removed by a given number of steps from this.
|
static long |
numberOfStepsBetween(GeoHash gh1,
GeoHash gh2) |
GeoHash |
prev()
Finds the previous geohash
|
java.lang.String |
toBinaryString()
Computes an equivalent bit string representation of the geohash
|
boolean |
within(GeoHash gh)
Checks whether the mer of the given geohash is inside the mer of this
|
boolean |
within(JPoint2DD point)
Checks whether the given point is inside the mer of this.
|
public static final java.lang.String base32
public GeoHash()
public GeoHash(double longitude, double latitude, int hashLength)
public static GeoHash geohash(double longitude, double latitude, int hashLength)
longitude
- longitude of the pointlatitude
- latitude of the pointhashLength
- precision of geohash in number of characterspublic static GeoHash geohashWithBitsLength(double longitude, double latitude, int numberOfBits)
longitude
- longitude of the pointlatitude
- latitude of the pointnumberOfBits
- precision of geohash in number of bitspublic static GeoHash geohash(java.lang.String bitString)
bitString
- bit stringpublic static GeoHash geohash(long value, int hashLength)
value
- valuehashLength
- precision of the geohash in number of characterspublic static GeoHash geohashFromString(java.lang.String base32String)
base32String
- base32 stringpublic static int[] geohashBits(double longitude, double latitude, int numBits)
public java.lang.String getGeoHashString()
public double[] getMer()
public short getNumberOfBits()
public long getDecimalValue()
public JPoint2DD getCenterPoint()
public long getValue()
public java.lang.String toBinaryString()
public GeoHash next(int numberOfSteps)
numberOfSteps
- number of steps to be movedpublic GeoHash next()
public GeoHash prev()
public static double[] asMer(java.lang.String geohash)
public GeoHash getGeoHashToTheNorth()
public GeoHash getGeoHashToTheEast()
public GeoHash getGeoHashToTheSouth()
public GeoHash getGeoHashToTheWest()
public GeoHash[] getEightNeighbors()
public boolean within(GeoHash gh)
gh
- geohash to be checkedpublic boolean within(JPoint2DD point)
point
- point to be checkedpublic static long decimalValue(java.lang.String ghString)
ghString
- base32 geohash stringpublic java.lang.String geohashString(double longitude, double latitude, int hashLength)