Search in sources :

Example 6 with DistanceUnit

use of org.opensearch.common.unit.DistanceUnit in project OpenSearch by opensearch-project.

the class GeometryIO method readCircle.

private static Circle readCircle(StreamInput in) throws IOException {
    double lon = in.readDouble();
    double lat = in.readDouble();
    double alt = readAlt(in);
    double radius = in.readDouble();
    DistanceUnit distanceUnit = DistanceUnit.readFromStream(in);
    return new Circle(lon, lat, alt, distanceUnit.toMeters(radius));
}
Also used : Circle(org.opensearch.geometry.Circle) DistanceUnit(org.opensearch.common.unit.DistanceUnit)

Aggregations

DistanceUnit (org.opensearch.common.unit.DistanceUnit)6 GeoPoint (org.opensearch.common.geo.GeoPoint)3 XContentParser (org.opensearch.common.xcontent.XContentParser)3 ParsingException (org.opensearch.common.ParsingException)2 GeoDistance (org.opensearch.common.geo.GeoDistance)2 ArrayList (java.util.ArrayList)1 LatLonPoint (org.apache.lucene.document.LatLonPoint)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Coordinate (org.locationtech.jts.geom.Coordinate)1 Point (org.locationtech.spatial4j.shape.Point)1 Token (org.opensearch.common.xcontent.XContentParser.Token)1 Circle (org.opensearch.geometry.Circle)1 AbstractQueryBuilder.parseInnerQueryBuilder (org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder)1 GeoValidationMethod (org.opensearch.index.query.GeoValidationMethod)1 QueryBuilder (org.opensearch.index.query.QueryBuilder)1