Examples of DWithin


Examples of org.opengis.filter.spatial.DWithin

                }
               
                // Add range to filter
                AttributeExpression geomAttb = filterFactory.createAttributeExpression(meta.getFeatureType(), meta.getFeatureType().getDefaultGeometry().getName());
                LiteralExpression pointExpr = filterFactory.createLiteralExpression(request.getPoint());
                DWithin dWithin = filterFactory.dwithin(geomAttb, pointExpr, request.getMaxRange(), request.getUnits());
                if (query.getFilter() == null) {
                    query.addFilter((Filter)dWithin);
                   
                } else {
                    And andFilter = filterFactory.and(Arrays.asList(new Filter[] { (Filter)dWithin, query.getFilter() }));
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

       
        OGCConfiguration configuration = new OGCConfiguration();
        configuration.getProperties().add(Properties.IGNORE_SCHEMA_LOCATION);

        Parser parser = new Parser(configuration);
        DWithin filter = (DWithin) parser.parse(new ByteArrayInputStream(xml.getBytes()));
        assertNotNull(filter);
       
        //Asserting the Property Name
        assertNotNull(filter.getExpression1());
        PropertyName propName = (PropertyName) filter.getExpression1();
        String name = propName.getPropertyName();
        assertEquals("the_geom", name);
       
        //Asserting the Geometry
        assertNotNull(filter.getExpression2());
        Literal geom = (Literal) filter.getExpression2();
        assertEquals("POINT (-74.817265 40.5296504)", geom.toString());
       
        //Asserting the Distance
        assertTrue(filter.getDistance() > 0 );
        Double dist = filter.getDistance();
        assertEquals(200.0, dist);
       
        //Asserting the Distance Units
        assertNotNull(filter.getDistanceUnits());
        String unit = filter.getDistanceUnits();
        assertEquals("km", unit);
     }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

          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);
          assertEquals(0, features.size());
      }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        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);
        assertEquals(1, features.size());
        checkSingleResult(features, "r2");
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

    }

    public void testPointDistance() throws IOException, ParseException {
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Geometry point = new WKTReader().read("POINT(180000 0)");
        DWithin filter = ff.dwithin(ff.property(aname("geom")), ff.literal(point), 15000, "m");
       
        ContentFeatureCollection fc = dataStore.getFeatureSource(tname("ppoint")).getFeatures(filter);
        assertEquals(1, fc.size());
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

import org.w3c.dom.Document;

public class DWithinBindingTest extends FESTestSupport {

    public void testEncode() throws Exception {
        DWithin dwithin = FilterMockData.dwithin();
        Document dom = encode(dwithin, FES.DWithin);
        print(dom);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

      
       OGCConfiguration configuration = new OGCConfiguration();
       configuration.getProperties().add(Properties.IGNORE_SCHEMA_LOCATION);

       Parser parser = new Parser(configuration);
       DWithin filter = (DWithin) parser.parse(new ByteArrayInputStream(xml.getBytes()));
       assertNotNull(filter);
      
       //Asserting the Property Name
       assertNotNull(filter.getExpression1());
       PropertyName propName = (PropertyName) filter.getExpression1();
       String name = propName.getPropertyName();
       assertEquals("the_geom", name);
      
       //Asserting the Geometry
       assertNotNull(filter.getExpression2());
       Literal geom = (Literal) filter.getExpression2();
       assertEquals("POINT (-74.817265 40.5296504)", geom.toString());
      
       //Asserting the Distance
       assertTrue(filter.getDistance() > 0 );
       Double dist = filter.getDistance();
       assertEquals(200.0, dist);
      
       //Asserting the Distance Units
       assertNotNull(filter.getDistanceUnits());
       String unit = filter.getDistanceUnits();
       assertEquals("km", unit);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

    }

    public void testDWithinParse() throws Exception {
        FilterMockData.dwithin(document, document);

        DWithin dwithin = (DWithin) parse();

        assertNotNull(dwithin.getExpression1());
        assertNotNull(dwithin.getExpression2());
        assertEquals(1.0, dwithin.getDistance(), 0.1);
        assertEquals("m", dwithin.getDistanceUnits());
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

    }

    public void testDWithinParse() throws Exception {
        FilterMockData.dwithin(document, document);

        DWithin dwithin = (DWithin) parse();

        assertNotNull(dwithin.getExpression1());
        assertNotNull(dwithin.getExpression2());
        assertEquals(1.0, dwithin.getDistance(), 0.1);
        assertEquals("m",dwithin.getDistanceUnits());
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        assertEquals("WHERE SDO_RELATE(\"GEOM\", ?, 'mask=overlapbdyintersect querytype=WINDOW') = 'TRUE' ", encoded);
    }
   
    public void testDWithinFilterWithUnit() throws Exception {
        Coordinate coordinate = new Coordinate();
    DWithin dwithin = ff.dwithin(ff.property("GEOM"), ff.literal(gf.createPoint(coordinate)), 10.0, "kilometers");
        String encoded = encoder.encodeToString(dwithin);
        assertEquals("WHERE SDO_WITHIN_DISTANCE(\"GEOM\",?,'distance=10.0 unit=km') = 'TRUE' ", encoded);
    }
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.