public class GeoHashUtils extends Object
Modifier and Type | Field and Description |
---|---|
static char[] |
BASE_32 |
static String |
BASE_32_STRING |
static int |
PRECISION |
Constructor and Description |
---|
GeoHashUtils() |
Modifier and Type | Method and Description |
---|---|
static <E extends Collection<? super String>> |
addNeighbors(String geohash,
E neighbors)
Add all geohashes of the cells next to a given geohash to a list.
|
static <E extends Collection<? super String>> |
addNeighbors(String geohash,
int length,
E neighbors)
Add all geohashes of the cells next to a given geohash to a list.
|
static long |
fromMorton(long morton,
int level) |
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(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(String hash)
Encode to a morton long value from a given geohash string
|
static String |
neighbor(String geohash,
int level,
int dx,
int dy)
Calculate the geohash of a neighbor of a geohash
|
static Collection<? extends CharSequence> |
neighbors(String geohash)
Calculate all neighbors of a given geohash cell.
|
static String |
stringEncode(double lon,
double lat)
Encode to a geohash string from full resolution longitude, latitude)
|
static String |
stringEncode(double lon,
double lat,
int level)
Encode to a level specific geohash string from full resolution longitude, latitude
|
static String |
stringEncode(long geoHashLong)
Encode to a geohash string from the geohash based long format
|
static String |
stringEncodeFromMortonLong(long hashedVal)
Encode to a full precision geohash string from a given morton encoded long value
|
static String |
stringEncodeFromMortonLong(long hashedVal,
int level)
Encode to a geohash string at a given level from a morton long
|
public static final char[] BASE_32
public static final String BASE_32_STRING
public static final int PRECISION
public static final long longEncode(double lon, double lat, int level)
public static final long longEncode(String hash)
public static long longEncode(long geohash, int level)
public static long fromMorton(long morton, int level)
public static final String stringEncode(long geoHashLong)
public static final String stringEncode(double lon, double lat)
public static final String stringEncode(double lon, double lat, int level)
public static final String stringEncodeFromMortonLong(long hashedVal) throws Exception
Exception
public static final String stringEncodeFromMortonLong(long hashedVal, int level)
public static final long mortonEncode(String hash)
public static final long mortonEncode(long geoHashLong)
public static Collection<? extends CharSequence> neighbors(String geohash)
geohash
- Geohash of the defined cellpublic static final String neighbor(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 Collection<? super String>> E addNeighbors(String geohash, E neighbors)
geohash
- Geohash of a specified cellneighbors
- list to add the neighbors topublic static final <E extends Collection<? super String>> E addNeighbors(String geohash, int length, E neighbors)
geohash
- Geohash of a specified celllength
- level of the given geohashneighbors
- list to add the neighbors toCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.