Package org.elasticsearch.common.geo

Examples of org.elasticsearch.common.geo.GeoPoint.lat()


        switch (values.setDocument(docId)) {
            case 0:
                return null;
            case 1:
                GeoPoint gp = values.nextValue();
                return new Double[] { gp.lon(), gp.lat() };
            default:
                throw new GroupByOnArrayUnsupportedException(columnName());
        }
    }
View Full Code Here


            final double lon = randomDouble() * 360 - 180;
            final Distance precision = new Distance(1+(randomDouble() * 9), randomFrom(Arrays.asList(DistanceUnit.MILLIMETERS, DistanceUnit.METERS, DistanceUnit.KILOMETERS)));
            final GeoPointFieldMapper.Encoding encoding = GeoPointFieldMapper.Encoding.of(precision);
            assertThat(encoding.precision().convert(DistanceUnit.METERS).value, lessThanOrEqualTo(precision.convert(DistanceUnit.METERS).value));
            final GeoPoint geoPoint = encoding.decode(encoding.encodeCoordinate(lat), encoding.encodeCoordinate(lon), new GeoPoint());
            final double error = GeoDistance.PLANE.calculate(lat, lon, geoPoint.lat(), geoPoint.lon(), DistanceUnit.METERS);
            assertThat(error, lessThanOrEqualTo(precision.convert(DistanceUnit.METERS).value));
        }
    }

}
View Full Code Here

            final int num = geoPointValues.count();
            if (num > 0) {
                double value = mode.startDouble();
                for (int i = 0; i < num; i++) {
                    GeoPoint other = geoPointValues.valueAt(i);
                    value = mode.apply(Math.max(0.0d, distFunction.calculate(origin.lat(), origin.lon(), other.lat(), other.lon(),
                            DistanceUnit.METERS) - offset), value);
                }
                return mode.reduce(value, num);
            } else {
                return 0.0;
View Full Code Here

            builder.startObject("top_left");
            builder.field("lat", topLeft.lat());
            builder.field("lon", topLeft.lon());
            builder.endObject();
            builder.startObject("bottom_right");
            builder.field("lat", bottomRight.lat());
            builder.field("lon", bottomRight.lon());
            builder.endObject();
            builder.endObject();
        }
        return builder;
View Full Code Here

        final int valuesCount = values.count();

        for (int i = 0; i < valuesCount; ++i) {
            GeoPoint value = values.valueAt(i);
            double top = tops.get(owningBucketOrdinal);
            if (value.lat() > top) {
                top = value.lat();
            }
            double bottom = bottoms.get(owningBucketOrdinal);
            if (value.lat() < bottom) {
                bottom = value.lat();
View Full Code Here

        for (int i = 0; i < valuesCount; ++i) {
            GeoPoint value = values.valueAt(i);
            double top = tops.get(owningBucketOrdinal);
            if (value.lat() > top) {
                top = value.lat();
            }
            double bottom = bottoms.get(owningBucketOrdinal);
            if (value.lat() < bottom) {
                bottom = value.lat();
            }
View Full Code Here

            double top = tops.get(owningBucketOrdinal);
            if (value.lat() > top) {
                top = value.lat();
            }
            double bottom = bottoms.get(owningBucketOrdinal);
            if (value.lat() < bottom) {
                bottom = value.lat();
            }
            double posLeft = posLefts.get(owningBucketOrdinal);
            if (value.lon() > 0 && value.lon() < posLeft) {
                posLeft = value.lon();
View Full Code Here

            if (value.lat() > top) {
                top = value.lat();
            }
            double bottom = bottoms.get(owningBucketOrdinal);
            if (value.lat() < bottom) {
                bottom = value.lat();
            }
            double posLeft = posLefts.get(owningBucketOrdinal);
            if (value.lon() > 0 && value.lon() < posLeft) {
                posLeft = value.lon();
            }
View Full Code Here

        }

        public double factorDistance(double lat, double lon) {
            GeoPoint point = getValue();
            return GeoDistance.FACTOR.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT);
        }

        public double factorDistanceWithDefault(double lat, double lon, double defaultValue) {
            if (isEmpty()) {
                return defaultValue;
View Full Code Here

        public double factorDistanceWithDefault(double lat, double lon, double defaultValue) {
            if (isEmpty()) {
                return defaultValue;
            }
            GeoPoint point = getValue();
            return GeoDistance.FACTOR.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT);
        }

        public double factorDistance02(double lat, double lon) {
            GeoPoint point = getValue();
            return GeoDistance.FACTOR.calculate(point.lat(), point.lon(), lat, lon, DistanceUnit.DEFAULT) + 1;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.