public final class GeoEncodingUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static short |
BITS
number of bits used for quantizing latitude and longitude values
|
private static double |
LAT_DECODE |
private static double |
LAT_SCALE |
private static double |
LON_DECODE |
private static double |
LON_SCALE |
| Modifier | Constructor and Description |
|---|---|
private |
GeoEncodingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static double |
decodeLatitude(byte[] src,
int offset)
Turns quantized value from byte array back into a double.
|
static double |
decodeLatitude(int encoded)
Turns quantized value from
encodeLatitude(double) back into a double. |
static double |
decodeLongitude(byte[] src,
int offset)
Turns quantized value from byte array back into a double.
|
static double |
decodeLongitude(int encoded)
Turns quantized value from
encodeLongitude(double) back into a double. |
static int |
encodeLatitude(double latitude)
Quantizes double (64 bit) latitude into 32 bits (rounding down: in the direction of -90)
|
static int |
encodeLatitudeCeil(double latitude)
Quantizes double (64 bit) latitude into 32 bits (rounding up: in the direction of +90)
|
static int |
encodeLongitude(double longitude)
Quantizes double (64 bit) longitude into 32 bits (rounding down: in the direction of -180)
|
static int |
encodeLongitudeCeil(double longitude)
Quantizes double (64 bit) longitude into 32 bits (rounding up: in the direction of +180)
|
public static final short BITS
private static final double LAT_SCALE
private static final double LAT_DECODE
private static final double LON_SCALE
private static final double LON_DECODE
public static int encodeLatitude(double latitude)
latitude - latitude value: must be within standard +/-90 coordinate bounds.intjava.lang.IllegalArgumentException - if latitude is out of boundspublic static int encodeLatitudeCeil(double latitude)
latitude - latitude value: must be within standard +/-90 coordinate bounds.intjava.lang.IllegalArgumentException - if latitude is out of boundspublic static int encodeLongitude(double longitude)
longitude - longitude value: must be within standard +/-180 coordinate bounds.intjava.lang.IllegalArgumentException - if longitude is out of boundspublic static int encodeLongitudeCeil(double longitude)
longitude - longitude value: must be within standard +/-180 coordinate bounds.intjava.lang.IllegalArgumentException - if longitude is out of boundspublic static double decodeLatitude(int encoded)
encodeLatitude(double) back into a double.encoded - encoded value: 32-bit quantized value.public static double decodeLatitude(byte[] src,
int offset)
src - byte array containing 4 bytes to decode at offsetoffset - offset into src to decode from.public static double decodeLongitude(int encoded)
encodeLongitude(double) back into a double.encoded - encoded value: 32-bit quantized value.public static double decodeLongitude(byte[] src,
int offset)
src - byte array containing 4 bytes to decode at offsetoffset - offset into src to decode from.