use of org.locationtech.geowave.core.geotime.util.GeometryUtils.GeometryHandler in project geowave by locationtech.
the class GeohashBinningHelper method getGeometryConstraints.
@Override
public ByteArrayConstraints getGeometryConstraints(final Geometry geometry, final int precision) {
final GeohashGeometryHandler geometryHandler = new GeohashGeometryHandler(precision);
GeometryUtils.visitGeometry(geometry, geometryHandler);
// this can really help with query performance
if (removePrefixes(geometryHandler.hashes)) {
return new ExplicitConstraints(geometryHandler.hashes.stream().map(str -> StringUtils.stringToBinary(str)).map(bytes -> new ByteArrayRange(bytes, bytes)).toArray(ByteArrayRange[]::new));
}
return new ExplicitConstraints(geometryHandler.hashes.stream().map(ByteArray::new).toArray(ByteArray[]::new));
}
Aggregations