public class GeoHash
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static byte |
BITS_PER_CHAR |
static java.util.HashMap<java.lang.Character,java.lang.Integer> |
charLookupTable
Allows lookups from a GeoHash character to its integer index value.
|
static char[] |
charMap
This character array maps integer values (array indices) to their
GeoHash base32 alphabet equivalents.
|
static int |
LATITUDE_RANGE |
static int |
LONGITUDE_RANGE |
Constructor and Description |
---|
GeoHash() |
Modifier and Type | Method and Description |
---|---|
static SpatialRange |
decodeHash(java.lang.String geoHash)
Decode a GeoHash to an approximate bounding box that contains the
original GeoHashed point.
|
static java.lang.String |
encode(Coordinates coords,
int precision)
Encode a set of
Coordinates into a GeoHash string. |
static java.lang.String |
encode(float latitude,
float longitude,
int precision)
Encode latitude and longitude into a GeoHash string.
|
static java.lang.String |
encode(SpatialRange range,
int precision)
Encode
SpatialRange into a GeoHash string. |
static long |
hashToLong(java.lang.String hash)
Convert a GeoHash String to a long integer.
|
public static final byte BITS_PER_CHAR
public static final int LATITUDE_RANGE
public static final int LONGITUDE_RANGE
public static final char[] charMap
public static final java.util.HashMap<java.lang.Character,java.lang.Integer> charLookupTable
public static java.lang.String encode(Coordinates coords, int precision)
Coordinates
into a GeoHash string.coords
- Coordinates to get GeoHash for.precision
- Desired number of characters in the returned GeoHash String. More
characters means more precision.public static java.lang.String encode(SpatialRange range, int precision)
SpatialRange
into a GeoHash string.range
- SpatialRange to get GeoHash for.precision
- Number of characters in the returned GeoHash String.
More characters is more precise.public static java.lang.String encode(float latitude, float longitude, int precision)
latitude
- Latitude coordinate, in degrees.longitude
- Longitude coordinate, in degrees.precision
- Number of characters in the returned GeoHash String.
More characters is more precise.public static long hashToLong(java.lang.String hash)
hash
- GeoHash String to convert.public static SpatialRange decodeHash(java.lang.String geoHash)
geoHash
- GeoHash string