Example usage for org.apache.lucene.geo GeoEncodingUtils decodeLatitude

List of usage examples for org.apache.lucene.geo GeoEncodingUtils decodeLatitude

Introduction

In this page you can find the example usage for org.apache.lucene.geo GeoEncodingUtils decodeLatitude.

Prototype

public static double decodeLatitude(byte[] src, int offset) 

Source Link

Document

Turns quantized value from byte array back into a double.

Usage

From source file:org.codelibs.elasticsearch.common.geo.GeoPoint.java

License:Apache License

public GeoPoint resetFromIndexableField(IndexableField field) {
    if (field instanceof LatLonPoint) {
        BytesRef br = field.binaryValue();
        byte[] bytes = Arrays.copyOfRange(br.bytes, br.offset, br.length);
        return this.reset(GeoEncodingUtils.decodeLatitude(bytes, 0),
                GeoEncodingUtils.decodeLongitude(bytes, Integer.BYTES));
    } else if (field instanceof LatLonDocValuesField) {
        long encoded = (long) (field.numericValue());
        return this.reset(GeoEncodingUtils.decodeLatitude((int) (encoded >>> 32)),
                GeoEncodingUtils.decodeLongitude((int) encoded));
    }/*from  ww  w .  j  a  v  a2s  . com*/
    return resetFromIndexHash(Long.parseLong(field.stringValue()));
}