Search in sources :

Example 1 with XShapeCollection

use of org.elasticsearch.common.geo.XShapeCollection in project elasticsearch by elastic.

the class MultiPointBuilder method build.

@Override
public Shape build() {
    //Could wrap JtsGeometry but probably slower due to conversions to/from JTS in relate()
    //MultiPoint geometry = FACTORY.createMultiPoint(points.toArray(new Coordinate[points.size()]));
    List<Point> shapes = new ArrayList<>(coordinates.size());
    for (Coordinate coord : coordinates) {
        shapes.add(SPATIAL_CONTEXT.makePoint(coord.x, coord.y));
    }
    XShapeCollection<Point> multiPoints = new XShapeCollection<>(shapes, SPATIAL_CONTEXT);
    multiPoints.setPointsOnly(true);
    return multiPoints;
}
Also used : Coordinate(com.vividsolutions.jts.geom.Coordinate) XShapeCollection(org.elasticsearch.common.geo.XShapeCollection) ArrayList(java.util.ArrayList) Point(org.locationtech.spatial4j.shape.Point)

Aggregations

Coordinate (com.vividsolutions.jts.geom.Coordinate)1 ArrayList (java.util.ArrayList)1 XShapeCollection (org.elasticsearch.common.geo.XShapeCollection)1 Point (org.locationtech.spatial4j.shape.Point)1