org.elasticsearch.index.search.geo
Class GeoHashUtils

java.lang.Object
  extended by org.elasticsearch.index.search.geo.GeoHashUtils

public class GeoHashUtils
extends Object

Utilities for encoding and decoding geohashes. Based on http://en.wikipedia.org/wiki/Geohash.


Field Summary
static int PRECISION
           
 
Method Summary
static double[] decode(String geohash)
           
static void decode(String geohash, double[] ret)
          Decodes the given geohash into a latitude and longitude
static String encode(double latitude, double longitude)
           
static 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
 

Field Detail

PRECISION

public static final int PRECISION
See Also:
Constant Field Values
Method Detail

encode

public static String encode(double latitude,
                            double longitude)

encode

public static String encode(double latitude,
                            double longitude,
                            int precision)
Encodes the given latitude and longitude into a geohash

Parameters:
latitude - Latitude to encode
longitude - Longitude to encode
Returns:
Geohash encoding of the longitude and latitude

decode

public static double[] decode(String geohash)

decode

public static void decode(String geohash,
                          double[] ret)
Decodes the given geohash into a latitude and longitude

Parameters:
geohash - Geohash to deocde


Copyright © 2009-2012. All Rights Reserved.