org.opengis.filter.spatial.Beyond Java Examples

The following examples show how to use org.opengis.filter.spatial.Beyond. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterToElasticHelper.java    From elasticgeo with GNU General Public License v3.0 6 votes vote down vote up
private void visitDistanceSpatialOperator(DistanceBufferOperator filter,
                                          PropertyName property, Literal geometry, boolean swapped,
                                          Object extraData) {

    property.accept(delegate, extraData);
    key = (String) delegate.field;
    geometry.accept(delegate, extraData);
    final Geometry geo = delegate.currentGeometry;
    double lat = geo.getCentroid().getY();
    double lon = geo.getCentroid().getX();
    final double inputDistance = filter.getDistance();
    final String inputUnits = filter.getDistanceUnits();
    double distance = Double.valueOf(toMeters(inputDistance, inputUnits));

    delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
            "filter", ImmutableMap.of("geo_distance", 
                    ImmutableMap.of("distance", distance +"m", key, ImmutableList.of(lon, lat)))));

    if ((filter instanceof DWithin && swapped)
            || (filter instanceof Beyond && !swapped)) {
        delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", delegate.queryBuilder));
    }
}
 
Example #2
Source File: ElasticCapabilities.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
public ElasticCapabilities() {
    super(new ElasticFilterCapabilities());

    addAll(LOGICAL_OPENGIS);
    addAll(SIMPLE_COMPARISONS_OPENGIS);
    addType(PropertyIsNull.class);
    addType(PropertyIsBetween.class);
    addType(Id.class);
    addType(IncludeFilter.class);
    addType(ExcludeFilter.class);
    addType(PropertyIsLike.class);

    // spatial filters
    addType(BBOX.class);
    addType(Contains.class);
    //addType(Crosses.class);
    addType(Disjoint.class);
    //addType(Equals.class);
    addType(Intersects.class);
    //addType(Overlaps.class);
    //addType(Touches.class);
    addType(Within.class);
    addType(DWithin.class);
    addType(Beyond.class);

    //temporal filters
    addType(After.class);
    addType(Before.class);
    addType(Begins.class);
    addType(BegunBy.class);
    addType(During.class);
    addType(Ends.class);
    addType(EndedBy.class);
    addType(TContains.class);
    addType(TEquals.class);
}
 
Example #3
Source File: ElasticGeometryFilterIT.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testBeyondFilter() throws Exception {
    init();
    FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
    GeometryFactory gf = new GeometryFactory();
    PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
    Point ls = gf.createPoint(sf.create(new double[] { 0, 0 }, 2));
    Beyond f = ff.beyond(ff.property("geo"), ff.literal(ls), 1, "m");
    SimpleFeatureCollection features = featureSource.getFeatures(f);
    assertEquals(9, features.size());
}
 
Example #4
Source File: ElasticFilterTest.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testDBeyondFilter() throws CQLException {
    Beyond filter = (Beyond) ECQL.toFilter("BEYOND(\"geo_point\", POINT(0 1.1), 1.0, meters)");
    Map<String,Object> expected = ImmutableMap.of("bool", ImmutableMap.of("must_not", ImmutableMap.of("bool", 
            ImmutableMap.of("must", MATCH_ALL, "filter", ImmutableMap.of("geo_distance", ImmutableMap.of("distance", "1.0m",
                    "geo_point", ImmutableList.of(0.,1.1)))))));

    builder.visit(filter, null);
    assertTrue(builder.createCapabilities().fullySupports(filter));
    assertEquals(expected, builder.getQueryBuilder());       
}
 
Example #5
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Beyond filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #6
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Beyond filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #7
Source File: FilterToElastic.java    From elasticgeo with GNU General Public License v3.0 4 votes vote down vote up
public Object visit(Beyond filter, Object extraData) {
    return visitBinarySpatialOperator(filter, extraData);
}
 
Example #8
Source File: ExtractGeometryFilterVisitor.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Object visit(final Beyond filter, final Object data) {
  // beyond a certain distance from a finite object, no way to limit it
  return new ExtractGeometryFilterVisitorResult(infinity(), null);
}
 
Example #9
Source File: ExtractTimeFilterVisitor.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Object visit(final Beyond filter, final Object data) {
  return new TemporalConstraints();
}
 
Example #10
Source File: CriteriaVisitor.java    From geomajas-project-server with GNU Affero General Public License v3.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public Object visit(Beyond filter, Object userData) {
	throw new UnsupportedOperationException("visit(Beyond filter, Object userData)");
}