Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.BBOX


        assertEquals(bbox, clone);
    }
   
    public void testBboxReprojectUnreferencedBBox() {
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        BBOX bbox = ff.bbox(ff.property("geom"), 10, 15, 20, 25, null);
        Filter clone = (Filter) bbox.accept(reprojector, null);
        assertNotSame(bbox, clone);
        assertEquals(bbox, clone);
    }
View Full Code Here


            } else if(filter.getExpression2() instanceof Literal && ((Literal) filter.getExpression2()).getValue() instanceof Polygon) {
                Polygon expr2 = (Polygon) ((Literal) filter.getExpression2()).getValue();

                if (expr2.isRectangle()) {
                    FilterFactory2 factory = getFactory(extraData);
                    BBOX bbox = factory.bbox(factory.property(geomName), JTS.toEnvelope(expr2));

                    return bbox;
                } else {
                     return filter;
                }
View Full Code Here

    @Test
    public void testBBoxFilter() throws Exception {
        String typeName = testData.getTempTableName();
        SimpleFeatureSource fs = store.getFeatureSource(typeName);
        SimpleFeatureType schema = fs.getSchema();
        BBOX bboxFilter = ff.bbox(schema.getGeometryDescriptor().getLocalName(), -180, -90, 180,
                90, schema.getCoordinateReferenceSystem().getName().getCode());

        int expected = 0;
        SimpleFeatureIterator features = fs.getFeatures().features();
        try {
            while (features.hasNext()) {
                SimpleFeature next = features.next();
                if (bboxFilter.evaluate(next)) {
                    expected++;
                }
            }
        } finally {
            features.close();
View Full Code Here

     * A bbox filter with an empty attribute name should work against the default geometry attribute
     */
    @SuppressWarnings("nls")
    @Test
    public void testBboxFilterWithEmptyAttributeName() throws Exception {
        BBOX emptyAttNameFilter = ff.bbox("", -10, -10, 10, 10, "EPSG:4326");
        String typeName = testData.getTempTableName();

        SimpleFeatureSource source;
        source = store.getFeatureSource(typeName);
        SimpleFeatureCollection features;
View Full Code Here

                .println(this.dataStore.getFeatureSource(ft.getName().getLocalPart()).getBounds());

        // build a or of bbox so that
        // - the intersection of the bboxes is empty
        // - the union of the bboxes actually gets more data than necessary
        BBOX bbox1 = ff.bbox("SHAPE", -171, -90, -169, 90, "EPSG:4326");
        BBOX bbox2 = ff.bbox("SHAPE", 169, -90, 171, 90, "EPSG:4326");
        Filter filter = ff.or(bbox1, bbox2);

        runTestWithFilter(ft, filter, false);
    }
View Full Code Here

        assertEquals("results_value", ((PropertyName) unmappedAtt).getPropertyName());
    }
   
    @Test
    public void testBBox3D() throws Exception {
      BBOX bbox = ff.bbox("location", new ReferencedEnvelope3D(0, 10, 20, 50, 60, 70, null));
     
      assertTrue(bbox instanceof BBOX3DImpl);
      BBOX3DImpl bbox3d = (BBOX3DImpl) bbox;
     
      Filter unrolled = (Filter) bbox.accept(visitor, null);
     
      assertTrue(unrolled instanceof BBOX3DImpl);
      BBOX3DImpl unrolled3d = (BBOX3DImpl) unrolled;
      assertEquals(bbox3d.getMinX(), unrolled3d.getMinX(), 0.0);
      assertEquals(bbox3d.getMaxX(), unrolled3d.getMaxX(), 0.0);
View Full Code Here

   * @return
   * @throws IOException
   */
  private BBOX createFilterFromBounds() throws IOException{
    Envelope env = this.getBounds();
    BBOX myfilter = ff.bbox(getSchema().getGeometryDescriptor().getLocalName(), env.getMinX(), env.getMinY(), env.getMaxX(), env.getMaxY(), getSchema().getCoordinateReferenceSystem().toString());
        return myfilter;
  }
View Full Code Here

      }
 
    public void testBboxFilter() throws Exception {
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        // should  match  "r2" and "r3"
        BBOX bbox = ff.bbox(aname("geom"), 2, 3, 4, 5, "EPSG:4326");
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(bbox);
        assertEquals(2, features.size());
    }
View Full Code Here

    }
     
    public void testBboxFilterDefault() throws Exception {
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        // should  match  "r2" and "r3"
        BBOX bbox = ff.bbox("", 2, 3, 4, 5, "EPSG:4326");
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(bbox);
        assertEquals(2, features.size());
    }
View Full Code Here

    public void testLooseBboxFilter() throws Exception {
        ((OracleDialect) dataStore.getSQLDialect()).setLooseBBOXEnabled(true);
       
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        // should match only "r2"
        BBOX bbox = ff.bbox(aname("geom"), 2, 3.5, 4, 4.5, "EPSG:4326");
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(bbox);
        checkSingleResult(features, "r2");
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.spatial.BBOX

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.