Search in sources :

Example 1 with GeometryHandler

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));
}
Also used : ByteArray(org.locationtech.geowave.core.index.ByteArray) StringUtils(org.locationtech.geowave.core.index.StringUtils) Coverage(com.github.davidmoten.geo.Coverage) Set(java.util.Set) GeometryHandler(org.locationtech.geowave.core.geotime.util.GeometryUtils.GeometryHandler) Point(org.locationtech.jts.geom.Point) GeometryUtils(org.locationtech.geowave.core.geotime.util.GeometryUtils) Collectors(java.util.stream.Collectors) ByteArrayConstraints(org.locationtech.geowave.core.store.api.BinConstraints.ByteArrayConstraints) ExplicitConstraints(org.locationtech.geowave.core.store.statistics.query.BinConstraintsImpl.ExplicitConstraints) HashSet(java.util.HashSet) LineString(org.locationtech.jts.geom.LineString) HashMultimap(com.google.common.collect.HashMultimap) GeoHash(com.github.davidmoten.geo.GeoHash) LatLong(com.github.davidmoten.geo.LatLong) Entry(java.util.Map.Entry) Polygon(org.locationtech.jts.geom.Polygon) Geometry(org.locationtech.jts.geom.Geometry) ByteArrayRange(org.locationtech.geowave.core.index.ByteArrayRange) Envelope(org.locationtech.jts.geom.Envelope) ByteArray(org.locationtech.geowave.core.index.ByteArray) ExplicitConstraints(org.locationtech.geowave.core.store.statistics.query.BinConstraintsImpl.ExplicitConstraints) ByteArrayRange(org.locationtech.geowave.core.index.ByteArrayRange)

Aggregations

Coverage (com.github.davidmoten.geo.Coverage)1 GeoHash (com.github.davidmoten.geo.GeoHash)1 LatLong (com.github.davidmoten.geo.LatLong)1 HashMultimap (com.google.common.collect.HashMultimap)1 HashSet (java.util.HashSet)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 GeometryUtils (org.locationtech.geowave.core.geotime.util.GeometryUtils)1 GeometryHandler (org.locationtech.geowave.core.geotime.util.GeometryUtils.GeometryHandler)1 ByteArray (org.locationtech.geowave.core.index.ByteArray)1 ByteArrayRange (org.locationtech.geowave.core.index.ByteArrayRange)1 StringUtils (org.locationtech.geowave.core.index.StringUtils)1 ByteArrayConstraints (org.locationtech.geowave.core.store.api.BinConstraints.ByteArrayConstraints)1 ExplicitConstraints (org.locationtech.geowave.core.store.statistics.query.BinConstraintsImpl.ExplicitConstraints)1 Envelope (org.locationtech.jts.geom.Envelope)1 Geometry (org.locationtech.jts.geom.Geometry)1 LineString (org.locationtech.jts.geom.LineString)1 Point (org.locationtech.jts.geom.Point)1 Polygon (org.locationtech.jts.geom.Polygon)1