Package org.opengis.filter

Examples of org.opengis.filter.PropertyIsEqualTo


    @Test
    public void testCircle() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")), ff.literal("Circle"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
View Full Code Here


    @Test
    public void testCompoundPolygon() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Compound polygon"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
View Full Code Here

    @Test
    public void testCompoundPolygonWithHole() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Compound polygon with hole"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
View Full Code Here

    @Test
    public void testMultipolygon() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Multipolygon with curves"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
View Full Code Here

        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"));
        reader = dataStore.getFeatureReader(new DefaultQuery(tname("road"), filter), t);

        assertNotNull(reader);
        assertFalse(reader.hasNext());
        reader.close();
View Full Code Here

        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

        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

TOP

Related Classes of org.opengis.filter.PropertyIsEqualTo

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.