Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory


                fid = reader.next().getID();
            } finally {
                reader.close();
            }

            final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
            Set<FeatureId> ids = new HashSet<FeatureId>();
            ids.add(ff.featureId(fid));
            fidFilter = ff.id(ids);
        }

        {
            FeatureWriter<SimpleFeatureType, SimpleFeature> writer;
            writer = ds.getFeatureWriter(typeName, fidFilter, Transaction.AUTO_COMMIT);
View Full Code Here


        fStore = (SimpleFeatureStore) ds.getFeatureSource(typeName);
        final Transaction transaction = new DefaultTransaction("testInsertTransactionAndQueryByFid");
        fStore.setTransaction(transaction);
        try {
            final List<FeatureId> addedFids = fStore.addFeatures(testFeatures);
            final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

            final Set<FeatureId> fids = new HashSet<FeatureId>();
            for (FeatureId fid : addedFids) {
                fids.add(fid);
            }
            final Id newFidsFilter = ff.id(fids);

            SimpleFeatureCollection features;
            features = fStore.getFeatures(newFidsFilter);
            assertEquals(2, features.size());
            transaction.commit();
View Full Code Here

            }
        }

        final Transaction transaction = new DefaultTransaction("testUpdateAdjacentPolygons");
        store.setTransaction(transaction);
        final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter fid1Filter = ff.id(Collections.singleton(ff.featureId(fid1)));
        Filter fid2Filter = ff.id(Collections.singleton(ff.featureId(fid2)));
        try {
            store.modifyFeatures(defaultGeometry.getName(), modif2, fid2Filter);
            store.modifyFeatures(defaultGeometry.getName(), modif1, fid1Filter);
            transaction.commit();
        } catch (Exception e) {
View Full Code Here

        } finally {
            reader.close();
        }
        LOGGER.info("Confirmed exactly one feature in new sde layer");

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        HashSet<FeatureId> ids = new HashSet<FeatureId>();
        ids.add(ff.featureId(newId));
        Filter idFilter = ff.id(ids);

        writer = ds.getFeatureWriter(typeName, idFilter, Transaction.AUTO_COMMIT);

        try {
            assertTrue(writer.hasNext());
View Full Code Here

            public void run() {
                try {
                    System.err.println("adding..");
                    List<FeatureId> addedFids = fStore.addFeatures(testFeatures);
                    System.err.println("got " + addedFids);
                    final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

                    final Set<FeatureId> fids = new HashSet<FeatureId>();
                    for (FeatureId fid : addedFids) {
                        fids.add(fid);
                    }
                    final Id newFidsFilter = ff.id(fids);

                    System.err.println("querying..");
                    SimpleFeatureCollection features = fStore.getFeatures(newFidsFilter);
                    System.err.println("querying returned...");
View Full Code Here

    public void testAttributeFilters() throws Exception {
        OGRDataStore s = new OGRDataStore(getAbsolutePath(STATE_POP), null, null, ogr);
        FeatureSource fs = s.getFeatureSource(s.getTypeNames()[0]);
       
        // equality filter
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter f = ff.equal(ff.property("STATE_NAME"), ff.literal("New York"), true);
        assertEquals(1, fs.getFeatures(f).size());
       
        // greater than
        f = ff.greater(ff.property("PERSONS"), ff.literal(10000000));
        assertEquals(6, fs.getFeatures(f).size());
       
        // mix in a filter that cannot be encoded
        f = ff.and(f, ff.like(ff.property("STATE_NAME"), "C*"));
        assertEquals(1, fs.getFeatures(f).size());
    }
View Full Code Here

        File tmpFile = getTempFile("test-sql", ".sqlite");
        tmpFile.delete();
        OGRDataStore s = new OGRDataStore(tmpFile.getAbsolutePath(), "SQLite", null, ogr);
        s.createSchema(features, true, null);
        assertEquals(1, s.getTypeNames().length);
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Query query = new Query();
        query.setSortBy(new org.opengis.filter.sort.SortBy[] {
            ff.sort("f", org.opengis.filter.sort.SortOrder.ASCENDING)
        });
        SimpleFeatureCollection fc = s.getFeatureSource("junk").getFeatures(query);
        assertEquals(features.size(), fc.size());
        // Read
        int c = 0;
View Full Code Here

    public void testGeometryFilters() throws Exception {
        OGRDataStore s = new OGRDataStore(getAbsolutePath(STATE_POP), null, null, ogr);
        FeatureSource fs = s.getFeatureSource(s.getTypeNames()[0]);
       
        // from one of the GeoServer demo requests
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter f = ff.bbox("the_geom", -75.102613, 40.212597, -72.361859,41.512517, null);
        assertEquals(4, fs.getFeatures(f).size());
       
        // mix in an attribute filter
        f = ff.and(f, ff.greater(ff.property("PERSONS"), ff.literal("10000000")));
        assertEquals(6, fs.getFeatures(f).size());  
    }
View Full Code Here

                    Envelope bBox)
  throws Exception
  {
    boolean success = true;
   
    FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
    Filter filter = null;

    //JD: fix this !!
    //filter = (Filter) ff.createBBoxExpression(bBox);
View Full Code Here

        assertTrue(areCRSEqual(CRS.decode("EPSG:4326"), bounds.getCoordinateReferenceSystem()));
    }

    public void testBoundsWithQuery() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equals(ff.property(aname("stringProperty")), ff.literal("one"));

        Query query = new Query();
        query.setFilter(filter);

        ReferencedEnvelope bounds = featureSource.getBounds(query);
View Full Code Here

TOP

Related Classes of org.opengis.filter.FilterFactory

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.