org.elasticsearch.index.search.geo
Class GeoHashUtils
java.lang.Object
org.elasticsearch.index.search.geo.GeoHashUtils
public class GeoHashUtils
- extends java.lang.Object
Utilities for encoding and decoding geohashes. Based on
http://en.wikipedia.org/wiki/Geohash.
Method Summary |
static double[] |
decode(java.lang.String geohash)
|
static void |
decode(java.lang.String geohash,
double[] ret)
Decodes the given geohash into a latitude and longitude |
static java.lang.String |
encode(double latitude,
double longitude)
|
static java.lang.String |
encode(double latitude,
double longitude,
int precision)
Encodes the given latitude and longitude into a geohash |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PRECISION
public static final int PRECISION
- See Also:
- Constant Field Values
encode
public static java.lang.String encode(double latitude,
double longitude)
encode
public static java.lang.String encode(double latitude,
double longitude,
int precision)
- Encodes the given latitude and longitude into a geohash
- Parameters:
latitude
- Latitude to encodelongitude
- Longitude to encode
- Returns:
- Geohash encoding of the longitude and latitude
decode
public static double[] decode(java.lang.String geohash)
decode
public static void decode(java.lang.String geohash,
double[] ret)
- Decodes the given geohash into a latitude and longitude
- Parameters:
geohash
- Geohash to deocde