List of usage examples for org.apache.lucene.geo GeoEncodingUtils encodeLongitude
public static int encodeLongitude(double longitude)
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;//w ww . j a va2 s. c o m } return new InternalGeoCentroid(name, centroid, count, Collections.emptyList(), Collections.emptyMap()); }