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 lon,
double lat) |
static double |
mortonUnhashLat(long hash) |
static double |
mortonUnhashLon(long hash) |
static long |
prefixCodedToGeoCoded(BytesRef val)
Convert a prefix coded geo term back into the geocoded morton long
|
protected static long |
scaleLat(double val) |
protected static long |
scaleLon(double val) |
protected static double |
unscaleLat(long val) |
protected static double |
unscaleLon(long val) |
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 lon, double lat)
public static final double mortonUnhashLon(long hash)
public static final double mortonUnhashLat(long hash)
protected static final long scaleLon(double val)
protected static final long scaleLat(double val)
protected static final double unscaleLon(long val)
protected static final double unscaleLat(long val)
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.