Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory.literal()


        FilterFactory factory = CommonFactoryFinder.getFilterFactory(null);
        FilterFunction_geometryType geomTypeExpr = new FilterFunction_geometryType();
        geomTypeExpr.setParameters((List)Collections.singletonList(factory.property(aname("geom"))));

        PropertyIsEqualTo filter = factory.equals(geomTypeExpr, factory.literal("Polygon"));

        DefaultQuery query = new DefaultQuery(tname("road"), filter);
        query.setPropertyNames((List)Collections.singletonList(aname("id")));

         FeatureReader<SimpleFeatureType, SimpleFeature> reader = dataStore.getFeatureReader(query, t);
View Full Code Here


         FeatureReader<SimpleFeatureType, SimpleFeature> reader = dataStore.getFeatureReader(query, t);
        // if the above statement didn't throw an exception, we're content
        assertNotNull(reader);
        reader.close();

        filter = factory.equals(geomTypeExpr, factory.literal("LineString"));
        query.setFilter(filter);
        reader = dataStore.getFeatureReader(query, t);
        assertTrue(reader.hasNext());
        reader.close();
View Full Code Here

        Transaction t = new DefaultTransaction();
        SimpleFeatureType type = dataStore.getSchema(tname("river"));
         FeatureReader<SimpleFeatureType, SimpleFeature> reader;

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        PropertyIsEqualTo f = ff.equals(ff.property(aname("flow")), ff.literal(4.5));

        DefaultQuery q = new DefaultQuery(tname("river"));
        q.setPropertyNames(new String[] { aname("geom") });
        q.setFilter(f);
View Full Code Here

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        FilterFunction_ceil ceil = new FilterFunction_ceil();
        ceil.setParameters((List)Collections.singletonList(ff.property(aname("flow"))));

        PropertyIsEqualTo f = ff.equals(ceil, ff.literal(5));

        DefaultQuery q = new DefaultQuery(tname("river"));
        q.setPropertyNames(new String[] { aname("geom") });
        q.setFilter(f);
View Full Code Here

   
    public void testGetFeatureInvalidFilter() throws Exception {
        FeatureReader<SimpleFeatureType, SimpleFeature> reader;

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        PropertyIsEqualTo f = ff.equals(ff.property("invalidAttribute"), ff.literal(5));

        DefaultQuery q = new DefaultQuery(tname("river"));
        q.setPropertyNames(new String[] { aname("geom") });
        q.setFilter(f);
View Full Code Here

   
    public void testGetFeatureWriterInvalidFilter() {
        FeatureWriter<SimpleFeatureType, SimpleFeature> writer;

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        PropertyIsEqualTo f = ff.equals(ff.property("invalidAttribute"), ff.literal(5));

        // make sure a complaint related to the invalid filter is thrown here
        try {
            writer= dataStore.getFeatureWriter("river", f, Transaction.AUTO_COMMIT);
            writer.close();
View Full Code Here

     */
    public void testGetFeatureStoreModifyFeatures3() throws IOException {
        SimpleFeatureStore road = (SimpleFeatureStore) dataStore.getFeatureSource(tname("road"));

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        PropertyIsEqualTo filter = ff.equals(ff.property(aname("name")), ff.literal("r1"));

        AttributeDescriptor name = td.roadType.getDescriptor(aname("name"));
        road.modifyFeatures(new AttributeDescriptor[] { name, }, new Object[] { "changed", }, filter);
    }

View Full Code Here

        if (super.onlineTest("testGetFeatureReader")) {
            SFSDataStoreFactory factory = new SFSDataStoreFactory();
            SFSDataStore ods = (SFSDataStore) factory.createDataStore(createParams());
           
            FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
            Filter f1 = ff.equals(ff.property("CFCC"), ff.literal("A41"));
            Filter f2 = ff.equals(ff.property("CFCC"), ff.literal("A42"));
            Filter ored = ff.or(f1, f2);

            FeatureReader<SimpleFeatureType, SimpleFeature> r = ods.getFeatureReader(new Query(FEATURESOURCE, ored), Transaction.AUTO_COMMIT);
            assertNotNull(r);
View Full Code Here

            SFSDataStoreFactory factory = new SFSDataStoreFactory();
            SFSDataStore ods = (SFSDataStore) factory.createDataStore(createParams());
           
            FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
            Filter f1 = ff.equals(ff.property("CFCC"), ff.literal("A41"));
            Filter f2 = ff.equals(ff.property("CFCC"), ff.literal("A42"));
            Filter ored = ff.or(f1, f2);

            FeatureReader<SimpleFeatureType, SimpleFeature> r = ods.getFeatureReader(new Query(FEATURESOURCE, ored), Transaction.AUTO_COMMIT);
            assertNotNull(r);
            assertTrue(r.hasNext());
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    private QueryType buildTestQuery() {
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        final Function function1 = ff.function("MAX", new Expression[] { ff.literal(1),
                ff.literal(2) });
        final Function function2 = ff.function("MIN", new Expression[] { ff.literal(1),
                ff.literal(2) });

        final XlinkPropertyNameType xlinkPropertyName1 = factory.createXlinkPropertyNameType();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.