Search in sources :

Example 1 with SpatialQueryParametersProtos

use of org.locationtech.geowave.service.grpc.protobuf.SpatialQueryParametersProtos in project geowave by locationtech.

the class GeoWaveGrpcTestClient method spatialQuery.

public ArrayList<FeatureProtos> spatialQuery() throws UnsupportedEncodingException {
    LOGGER.info("Performing Spatial Query...");
    final VectorStoreParametersProtos baseParams = VectorStoreParametersProtos.newBuilder().setStoreName(GeoWaveGrpcTestUtils.storeName).setTypeName(GeoWaveGrpcTestUtils.typeName).setIndexName(GeoWaveGrpcTestUtils.indexName).build();
    final SpatialQueryParametersProtos request = SpatialQueryParametersProtos.newBuilder().setBaseParams(baseParams).setGeometry(copyFrom(GeoWaveGrpcTestUtils.wkbSpatialQuery)).build();
    Iterator<FeatureProtos> features;
    final ArrayList<FeatureProtos> feature_list = new ArrayList<>();
    features = vectorBlockingStub.spatialQuery(request);
    // iterate over features
    for (int i = 1; features.hasNext(); i++) {
        final FeatureProtos feature = features.next();
        feature_list.add(feature);
    }
    return feature_list;
}
Also used : SpatialQueryParametersProtos(org.locationtech.geowave.service.grpc.protobuf.SpatialQueryParametersProtos) FeatureProtos(org.locationtech.geowave.service.grpc.protobuf.FeatureProtos) ArrayList(java.util.ArrayList) VectorStoreParametersProtos(org.locationtech.geowave.service.grpc.protobuf.VectorStoreParametersProtos)

Example 2 with SpatialQueryParametersProtos

use of org.locationtech.geowave.service.grpc.protobuf.SpatialQueryParametersProtos in project geowave by locationtech.

the class GeoWaveGrpcTestClient method spatialTemporalQuery.

public ArrayList<FeatureProtos> spatialTemporalQuery() throws ParseException {
    LOGGER.info("Performing Spatial Temporal Query...");
    final VectorStoreParametersProtos baseParams = VectorStoreParametersProtos.newBuilder().setStoreName(GeoWaveGrpcTestUtils.storeName).build();
    final TimeZone tz = TimeZone.getTimeZone("UTC");
    // Quoted "Z" to indicate
    final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
    // UTC,
    // no timezone offset
    df.setTimeZone(tz);
    final SpatialQueryParametersProtos spatialQuery = SpatialQueryParametersProtos.newBuilder().setBaseParams(baseParams).setGeometry(copyFrom(GeoWaveGrpcTestUtils.wkbSpatialQuery)).build();
    final TemporalConstraintsProtos t = TemporalConstraintsProtos.newBuilder().setStartTime(Timestamps.fromMillis(df.parse(GeoWaveGrpcTestUtils.temporalQueryStartTime).getTime())).setEndTime(Timestamps.fromMillis(df.parse(GeoWaveGrpcTestUtils.temporalQueryEndTime).getTime())).build();
    final SpatialTemporalQueryParametersProtos request = SpatialTemporalQueryParametersProtos.newBuilder().setSpatialParams(spatialQuery).addTemporalConstraints(0, t).setCompareOperation("CONTAINS").build();
    Iterator<FeatureProtos> features;
    final ArrayList<FeatureProtos> feature_list = new ArrayList<>();
    features = vectorBlockingStub.spatialTemporalQuery(request);
    // iterate over features
    while (features.hasNext()) {
        final FeatureProtos feature = features.next();
        feature_list.add(feature);
    }
    return feature_list;
}
Also used : TemporalConstraintsProtos(org.locationtech.geowave.service.grpc.protobuf.TemporalConstraintsProtos) TimeZone(java.util.TimeZone) SpatialQueryParametersProtos(org.locationtech.geowave.service.grpc.protobuf.SpatialQueryParametersProtos) SpatialTemporalQueryParametersProtos(org.locationtech.geowave.service.grpc.protobuf.SpatialTemporalQueryParametersProtos) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) FeatureProtos(org.locationtech.geowave.service.grpc.protobuf.FeatureProtos) ArrayList(java.util.ArrayList) VectorStoreParametersProtos(org.locationtech.geowave.service.grpc.protobuf.VectorStoreParametersProtos) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ArrayList (java.util.ArrayList)2 FeatureProtos (org.locationtech.geowave.service.grpc.protobuf.FeatureProtos)2 SpatialQueryParametersProtos (org.locationtech.geowave.service.grpc.protobuf.SpatialQueryParametersProtos)2 VectorStoreParametersProtos (org.locationtech.geowave.service.grpc.protobuf.VectorStoreParametersProtos)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 TimeZone (java.util.TimeZone)1 SpatialTemporalQueryParametersProtos (org.locationtech.geowave.service.grpc.protobuf.SpatialTemporalQueryParametersProtos)1 TemporalConstraintsProtos (org.locationtech.geowave.service.grpc.protobuf.TemporalConstraintsProtos)1