List of usage examples for org.apache.lucene.geo GeoEncodingUtils encodeLatitude
public static int encodeLatitude(double latitude)
From source file:org.elasticsearch.search.aggregations.metrics.geocentroid.InternalGeoCentroidTests.java
License:Apache License
@Override protected InternalGeoCentroid createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) { GeoPoint centroid = RandomGeoGenerator.randomPoint(random()); // Re-encode lat/longs to avoid rounding issue when testing InternalGeoCentroid#hashCode() and // InternalGeoCentroid#equals() int encodedLon = GeoEncodingUtils.encodeLongitude(centroid.lon()); centroid.resetLon(GeoEncodingUtils.decodeLongitude(encodedLon)); int encodedLat = GeoEncodingUtils.encodeLatitude(centroid.lat()); centroid.resetLat(GeoEncodingUtils.decodeLatitude(encodedLat)); long count = randomIntBetween(0, 1000); if (count == 0) { centroid = null;//from w ww . ja v a2 s . com } return new InternalGeoCentroid(name, centroid, count, Collections.emptyList(), Collections.emptyMap()); }