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
|
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
public static int encodeLatitude(double latitude)
latitude
- latitude value: must be within standard +/-90 coordinate bounds.int
IllegalArgumentException
- if latitude is out of boundspublic static int encodeLatitudeCeil(double latitude)
latitude
- latitude value: must be within standard +/-90 coordinate bounds.int
IllegalArgumentException
- if latitude is out of boundspublic static int encodeLongitude(double longitude)
longitude
- longitude value: must be within standard +/-180 coordinate bounds.int
IllegalArgumentException
- if longitude is out of boundspublic static int encodeLongitudeCeil(double longitude)
longitude
- longitude value: must be within standard +/-180 coordinate bounds.int
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 offset
offset
- 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 offset
offset
- offset into src
to decode from.Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.