public class GeoHashUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
PRECISION
maximum precision for geohash strings
|
Modifier and Type | Method and Description |
---|---|
static <E extends java.util.Collection<? super java.lang.String>> |
addNeighbors(java.lang.String geohash,
E neighbors)
Add all geohashes of the cells next to a given geohash to a list.
|
static <E extends java.util.Collection<? super java.lang.String>> |
addNeighbors(java.lang.String geohash,
int length,
E neighbors)
Add all geohashes of the cells next to a given geohash to a list.
|
static org.apache.lucene.geo.Rectangle |
bbox(java.lang.String geohash)
Computes the bounding box coordinates from a given geohash
|
static double |
decodeLatitude(java.lang.String geohash)
returns the latitude value from the string based geohash
|
static double |
decodeLongitude(java.lang.String geohash)
returns the latitude value from the string based geohash
|
static long |
fromMorton(long morton,
int level)
Convert from a morton encoded long from a geohash encoded long
|
static long |
longEncode(double lon,
double lat,
int level)
Encode lon/lat to the geohash based long format (lon/lat interleaved, 4 least significant bits = level)
|
static long |
longEncode(long geohash,
int level)
Encode an existing geohash long to the provided precision
|
static long |
longEncode(java.lang.String hash)
Encode from geohash string to the geohash based long format (lon/lat interleaved, 4 least significant bits = level)
|
static long |
mortonEncode(long geoHashLong)
Encode to a morton long value from a given geohash long value
|
static long |
mortonEncode(java.lang.String hash)
Encode to a morton long value from a given geohash string
|
static java.lang.String |
neighbor(java.lang.String geohash,
int level,
int dx,
int dy)
Calculate the geohash of a neighbor of a geohash
|
static java.util.Collection<? extends java.lang.CharSequence> |
neighbors(java.lang.String geohash)
Calculate all neighbors of a given geohash cell.
|
static java.lang.String |
stringEncode(double lon,
double lat)
Encode to a geohash string from full resolution longitude, latitude)
|
static java.lang.String |
stringEncode(double lon,
double lat,
int level)
Encode to a level specific geohash string from full resolution longitude, latitude
|
static java.lang.String |
stringEncode(long geoHashLong)
Encode to a geohash string from the geohash based long format
|
static java.lang.String |
stringEncodeFromMortonLong(long hashedVal)
Encode to a full precision geohash string from a given morton encoded long value
|
static java.lang.String |
stringEncodeFromMortonLong(long hashedVal,
int level)
Encode to a geohash string at a given level from a morton long
|
public static final int PRECISION
public static final long longEncode(double lon, double lat, int level)
public static final long longEncode(java.lang.String hash)
public static long longEncode(long geohash, int level)
public static long fromMorton(long morton, int level)
public static final java.lang.String stringEncode(long geoHashLong)
public static final java.lang.String stringEncode(double lon, double lat)
public static final java.lang.String stringEncode(double lon, double lat, int level)
public static final java.lang.String stringEncodeFromMortonLong(long hashedVal) throws java.lang.Exception
java.lang.Exception
public static final java.lang.String stringEncodeFromMortonLong(long hashedVal, int level)
public static final long mortonEncode(java.lang.String hash)
public static final long mortonEncode(long geoHashLong)
public static org.apache.lucene.geo.Rectangle bbox(java.lang.String geohash)
geohash
- Geohash of the defined cellpublic static java.util.Collection<? extends java.lang.CharSequence> neighbors(java.lang.String geohash)
geohash
- Geohash of the defined cellpublic static final java.lang.String neighbor(java.lang.String geohash, int level, int dx, int dy)
geohash
- the geohash of a celllevel
- level of the geohashdx
- delta of the first grid coordinate (must be -1, 0 or +1)dy
- delta of the second grid coordinate (must be -1, 0 or +1)public static final <E extends java.util.Collection<? super java.lang.String>> E addNeighbors(java.lang.String geohash, E neighbors)
geohash
- Geohash of a specified cellneighbors
- list to add the neighbors topublic static final <E extends java.util.Collection<? super java.lang.String>> E addNeighbors(java.lang.String geohash, int length, E neighbors)
geohash
- Geohash of a specified celllength
- level of the given geohashneighbors
- list to add the neighbors topublic static final double decodeLatitude(java.lang.String geohash)
public static final double decodeLongitude(java.lang.String geohash)