Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.PropertyName


          // For DB2, we must use the following line of code
          MultiLineString ml = gf.createMultiLineString(geometries);
         
          FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
         
          PropertyName p = ff.property(aname("geom"));       
          Literal collect = ff.literal(ml);
       
          DWithin dwithinGeomCo  = ((FilterFactory2) ff).dwithin(p, collect, 5, "meter");
          Query dq = new Query(tname("road"), dwithinGeomCo);
          SimpleFeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(dq);
View Full Code Here


    }

    protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Object extraData) {
        Expression ex1 = filter.getExpression1();
        Expression ex2 = filter.getExpression2();
        PropertyName pn = null;
        if (ex1 instanceof PropertyName && ex2 instanceof Literal) {
            pn = (PropertyName) ex1;
        } else if (ex1 instanceof Literal && ex2 instanceof PropertyName) {
            pn = (PropertyName) ex2;
        }
        if (pn != null) {
            String name = pn.getPropertyName();
            if(spatialProperties.containsKey(name)) {
                Integer count = spatialProperties.get(name);
                spatialProperties.put(name, count + 1);
            } else {
                spatialProperties.put(name, 1);
View Full Code Here

        Geometry[] geometries = {point};
        GeometryCollection geometry = new GeometryCollection(geometries, factory );

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

        PropertyName geomName = ff.property(aname("geom"));
        Literal lit = ff.literal(geometry);
       
        DWithin dwithinGeomFilter  = ((FilterFactory2) ff).dwithin(geomName, lit, distance, unit);
        Query query = new Query(tname("road"), dwithinGeomFilter);
        SimpleFeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(query);
View Full Code Here

    @Override
    public Object visit(BBOX filter, Object extraData) {
        // rename if necessary
        Expression e1 = filter.getExpression1();
        if(e1 instanceof PropertyName) {
            PropertyName pname = (PropertyName) e1;
            String name = pname.getPropertyName();
            if(name != null && name.equals(source)) {
                e1 = ff.property(target);
            }
        }
       
View Full Code Here

     * @throws IllegalFilterException
     */
    public static Filter toRangedFilter(String styleExpression, SimpleFeatureType featureType,
        String attributeTypeName, boolean upperBoundClosed)
        throws IllegalFilterException {
        PropertyName attrib = ff.property(attributeTypeName);
        String[] strs = styleExpression.split("\\.\\."); //$NON-NLS-1$

        if (strs.length != 2) {
            throw new IllegalArgumentException(
                "A ranged filter could not be created from the styleExpression given.");
View Full Code Here

        // eliminate spaces after commas
        String expr = styleExpression.replaceAll(",\\s+", ","); //$NON-NLS-1$//$NON-NLS-2$
        String[] attribValue = expr.split(","); //$NON-NLS-1$

        // create the first filter
        PropertyName attribExpr = ff.property(attributeTypeName);
        PropertyIsEqualTo cFilter = ff.equals(attribExpr, ff.literal(attribValue[0]));

        if (attribValue.length == 1) {
            return cFilter;
        }
View Full Code Here

        buildDocument(xml);
       
        Overlaps f = (Overlaps) parse();
        assertNotNull(f);
       
        PropertyName e1 = (PropertyName) f.getExpression1();
        assertEquals("Geometry", e1.getPropertyName());
       
        Literal e2 = (Literal) f.getExpression2();
        assertTrue(e2.getValue() instanceof Polygon);
    }
View Full Code Here

     * @throws IOException
     */
    @Test
    public void testPropertyNameSelection() throws IOException {
       
        PropertyName propertyName1 = ff.property("gsml:specification/gsml:GeologicUnit/gml:description");
        PropertyName propertyName2 = ff.property("gsml:specification/gsml:GeologicUnit/gsml:occurrence");
               
        List<PropertyName> properties = new ArrayList<PropertyName>();  
        properties.add(propertyName1);
        Query query = new Query();       
        query.setProperties(properties);
       
        FeatureCollection<FeatureType, Feature> mfCollection = mfSource.getFeatures(query);
               
        FeatureIterator iterator = mfCollection.features();
       
        int i = 0;
        while (iterator.hasNext()) {
            Feature feature = iterator.next();
            assertNotNull(propertyName1.evaluate(feature));
            assertNull(propertyName2.evaluate(feature));
            i++;
        }
        assertEquals(4, i);
       
       
        properties = new ArrayList<PropertyName>();  
        properties.add(propertyName2);
        query.setProperties(properties);
       
        mfCollection = mfSource.getFeatures(query);
       
        iterator = mfCollection.features();
       
        i = 0;
        while (iterator.hasNext()) {
            Feature feature = iterator.next();
            assertNotNull(propertyName2.evaluate(feature));
            assertNull(propertyName1.evaluate(feature));
            i++;
        }
        assertEquals(4, i);
       
View Full Code Here

        namespaces.declarePrefix("sa", SANS);
        namespaces.declarePrefix("geo", GEONS);
        namespaces.declarePrefix("xlink", XLINK.NAMESPACE);

        final FilterFactory2 ff = new FilterFactoryImplNamespaceAware(namespaces);
        final PropertyName propertyName = ff.property(queryProperty);
        final Literal literal = ff.literal(queryLiteral);

        final Filter filter = ff.equals(propertyName, literal);

        FeatureCollection<FeatureType, Feature> features = (FeatureCollection<FeatureType, Feature>) fSource
View Full Code Here

        assertEquals(l, cat);
    }
   
    public void testCatenateTwo() {
        Literal l = ff.literal("http://test?param=");
        PropertyName pn = ff.property("intAttribute");
        Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l, pn));
        assertTrue(cat instanceof Function);
        Function f = (Function) cat;
        assertEquals("Concatenate", f.getName());
        assertEquals(l, f.getParameters().get(0));
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.PropertyName

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.