public final class GeoEncodingUtils extends Object
Modifier and Type | Field and Description |
---|---|
static short |
BITS
number of bits used for quantizing latitude and longitude values
|
static int |
BUF_SIZE_LONG
The maximum term length (used for
byte[] buffer size)
for encoding geoEncoded values. |
static double |
TOLERANCE
rounding error for quantized latitude and longitude values
|
Modifier and Type | Method and Description |
---|---|
static double |
compare(double v1,
double v2)
Compare two position values within a
TOLERANCE factor |
protected static long |
fromBytes(byte b1,
byte b2,
byte b3,
byte b4,
byte b5,
byte b6,
byte b7,
byte b8)
Converts 8 bytes to a long value
|
static void |
geoCodedToPrefixCoded(long hash,
int shift,
BytesRefBuilder bytes)
Convert a geocoded morton long into a prefix coded geo term
|
static String |
geoTermToString(long term)
Converts a long value into a bit string (useful for debugging)
|
static int |
getPrefixCodedShift(BytesRef val)
Get the prefix coded geo term shift value
|
static Long |
mortonHash(double lat,
double lon)
encode latitude, longitude geopoint values using morton encoding method
https://en.wikipedia.org/wiki/Z-order_curve
|
static double |
mortonUnhashLat(long hash)
decode latitude value from morton encoded geo point
|
static double |
mortonUnhashLon(long hash)
decode longitude value from morton encoded geo point
|
static long |
prefixCodedToGeoCoded(BytesRef val)
Convert a prefix coded geo term back into the geocoded morton long
|
public static final short BITS
public static final int BUF_SIZE_LONG
byte[]
buffer size)
for encoding geoEncoded
values.public static final double TOLERANCE
public static final Long mortonHash(double lat, double lon)
public static final double mortonUnhashLon(long hash)
public static final double mortonUnhashLat(long hash)
public static double compare(double v1, double v2)
TOLERANCE
factorpublic static void geoCodedToPrefixCoded(long hash, int shift, BytesRefBuilder bytes)
public static long prefixCodedToGeoCoded(BytesRef val)
public static int getPrefixCodedShift(BytesRef val)
protected static long fromBytes(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8)
public static String geoTermToString(long term)
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.