Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.BBOX


    @Test
    public void testBBoxQuery() throws Exception {
        ContentFeatureSource featureSource = store.getFeatureSource("gttestdb.counties");
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        // pueblo county
        BBOX bbox = ff.bbox("geometry", -105.050678,37.734704,-104.053921,38.522548,null);
       
        Query query = new Query("geometry", bbox);
        assertEquals(1, featureSource.getCount(query));
       
        FeatureReader<SimpleFeatureType, SimpleFeature> reader = featureSource.getReader(query);
View Full Code Here


        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
       
        String attName = ds.getSchema(TYPE_NAME).getGeometryDescriptor().getLocalName();
        ReferencedEnvelope bounds = ds.getBounds(new Query(TYPE_NAME));
       
        BBOX filter = ff.bbox(ff.property(attName),bounds);
       
       
       
        Query query=new Query(TYPE_NAME, filter);
       
View Full Code Here

        SimpleFeatureSource featureSource = wfs.getFeatureSource(TO_EDIT_TYPE);
        final ReferencedEnvelope bounds = featureSource.getBounds();

        String srsName = CRS.toSRS(bounds.getCoordinateReferenceSystem());

        final BBOX bbox = FF.bbox("the_geom", bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(),
                bounds.getMaxY(), srsName);

        /**
         * This one does not implement the deprecated geotools filter interfaces
         */
        final BBOX strictBBox = new BBOX() {

            @Override
            public boolean evaluate(Object object) {
                return bbox.evaluate(object);
            }
View Full Code Here

        ReferencedEnvelope latLon = bounds.transform(wgs84LatLon, true);

        String latLonSrsName = "urn:x-ogc:def:crs:EPSG:4326";
        String lonLatSrsName = "EPSG:4326";

        final BBOX lonLatFilter = FF.bbox("the_geom", lonLat.getMinimum(0), lonLat.getMinimum(1),
                lonLat.getMaximum(0), lonLat.getMaximum(1), lonLatSrsName);

        final BBOX latLonFiler = FF.bbox("the_geom", latLon.getMinimum(0), latLon.getMinimum(1),
                latLon.getMaximum(0), latLon.getMaximum(1), latLonSrsName);

        final Query query = new Query(ft.getTypeName());
        query.setPropertyNames(new String[] { "the_geom" });
        query.setFilter(lonLatFilter);
View Full Code Here

                    }

                    if( bbox==null ){
                        query2=query;
                    }else{
                        BBOX newFilter = fac.bbox(attName, bbox.getMinX(), bbox.getMinY(),
                                bbox.getMaxX(), bbox.getMaxY(), "EPSG:4326");
                       
                        query2 = new Query(query);
                        query2.setFilter(newFilter);
                    }
View Full Code Here

     */
    public void testBBOX() throws IllegalFilterException {
       
        // Test BBOX
        AttributeExpressionImpl left = new AttributeExpressionImpl(testSchema, "testGeometry");
        BBOX bbox = fac.bbox(left, 0, 0, 10, 10, null);

        LOGGER.finer( bbox.toString());
        LOGGER.finer( "contains feature: " + bbox.evaluate(testFeature));
        assertTrue(bbox.evaluate(testFeature));

        bbox = fac.bbox(left, 0, 0, 1, 1, null);

        LOGGER.finer( bbox.toString());           
        LOGGER.finer( "contains feature: " + bbox.evaluate(testFeature));
        assertTrue(!bbox.evaluate(testFeature));
       
        bbox = fac.bbox(left, 0, 0, 10, 10, "EPSG:4326");

        LOGGER.finer( bbox.toString());           
        LOGGER.finer( "contains feature: " + bbox.evaluate(testFeature));
        assertTrue(bbox.evaluate(testFeature));
       
        bbox = fac.bbox(left, 0, 0, 10, 10, "");

        LOGGER.finer( bbox.toString());           
        LOGGER.finer( "contains feature: " + bbox.evaluate(testFeature));
        assertTrue(bbox.evaluate(testFeature));
       
       
    }
View Full Code Here

        fids.add(new FeatureIdImpl("comuni11.2671"));
        Query query = new Query(typeName, ff.bbox("the_geom", 4623055.0, 815134.0, 4629904.0, 820740.0, "EPSG:3857"));
       
        SimpleFeatureSource source = ds.getFeatureSource(typeName);
        source.getFeatures(query).features();
        BBOX filter = (BBOX)wfs.getRequest().getFilter();
       
        // filter coordinates are inverted
        assertEquals(815134.0, filter.getMinX(), 0.0);
        assertEquals(4623055.0, filter.getMinY(), 0.0);
        assertEquals(820740.0, filter.getMaxX(), 0.0);
        assertEquals(4629904.0, filter.getMaxY(), 0.0);
    }
View Full Code Here

        fids.add(new FeatureIdImpl("comuni11.2671"));
        Query query = new Query(typeName, ff.bbox("the_geom", 4623055.0, 815134.0, 4629904.0, 820740.0, "EPSG:3857"));
       
        SimpleFeatureSource source = ds.getFeatureSource(typeName);
        source.getFeatures(query).features();
        BBOX filter = (BBOX)wfs.getRequest().getFilter();
       
        // filter coordinates are NOT inverted
        assertEquals(4623055.0, filter.getMinX(), 0.0);
        assertEquals(815134.0, filter.getMinY(), 0.0);
        assertEquals(4629904.0 , filter.getMaxX(), 0.0);
        assertEquals(820740.0, filter.getMaxY(), 0.0);
    }
View Full Code Here

        fids.add(new FeatureIdImpl("comuni11.2671"));
        Query query = new Query(typeName, ff.bbox("the_geom", 4623055.0, 815134.0, 4629904.0, 820740.0, "EPSG:3857"));
       
        SimpleFeatureSource source = ds.getFeatureSource(typeName);
        source.getFeatures(query).features();
        BBOX filter = (BBOX)wfs.getRequest().getFilter();
       
        // filter coordinates are NOT inverted
        assertEquals(4623055.0, filter.getMinX(), 0.0);
        assertEquals(815134.0, filter.getMinY(), 0.0);
        assertEquals(4629904.0 , filter.getMaxX(), 0.0);
        assertEquals(820740.0, filter.getMaxY(), 0.0);
    }
View Full Code Here

        Envelope box = clip.getEnvelopeInternal();
        String srs = null;
        if(features.getSchema().getCoordinateReferenceSystem() != null) {
            srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem());
        }
        BBOX bboxFilter = ff.bbox("", box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs);
       
        // default value for preserve Z
        if(preserveZ == null) {
            preserveZ = false;
        }
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.