Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.Intersects


    }

    public void testIntersectsParse() throws Exception {
        FilterMockData.intersects(document, document);

        Intersects intersects = (Intersects) parse();

        assertNotNull(intersects.getExpression1());
        assertNotNull(intersects.getExpression2());
    }
View Full Code Here


        String encoded = encoder.encodeToString(crosses);
        assertEquals("WHERE SDO_RELATE(\"GEOM\", ?, 'mask=overlapbdydisjoint querytype=WINDOW') = 'TRUE' ", encoded);
    }
   
    public void testIntersectsFilter() throws Exception {
        Intersects intersects = ff.intersects(ff.property("GEOM"), ff.literal(gf
                .createLineString(new Coordinate[] { new Coordinate(-10.0d, -10.0d),
                        new Coordinate(10d, 10d) })));
        String encoded = encoder.encodeToString(intersects);
        assertEquals("WHERE SDO_RELATE(\"GEOM\", ?, 'mask=anyinteract querytype=WINDOW') = 'TRUE' ", encoded);
    }
View Full Code Here

        init("not-active");
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        Polygon ls = gf.createPolygon(sf.create(new double[] { 6, 6, 7, 6, 7, 7, 6, 7, 6, 6 }, 2));
        Intersects f = ff.intersects(ff.property("geo"), ff.literal(ls));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
        SimpleFeatureIterator fsi = features.features();
        assertTrue(fsi.hasNext());
        assertEquals(fsi.next().getID(), "not-active.13");
View Full Code Here

    }
   
    public void testIntersectsCRS() throws Exception {
        Filter test = parseDocument("intersectsCRS.xml");
        assertTrue(test instanceof Intersects);
        Intersects cr = (Intersects) test;
        assertEquals("geom", ((PropertyName) cr.getExpression1()).getPropertyName());
        Polygon p = (Polygon) ((Literal) cr.getExpression2()).getValue();
        assertTrue(p.getUserData() instanceof CoordinateReferenceSystem);
        int epsg = CRS.lookupEpsgCode((CoordinateReferenceSystem) p.getUserData(), false);
        assertEquals(32631, epsg);
    }
View Full Code Here

       
        // Test Disjoint
        AttributeExpressionImpl expr1 = new AttributeExpressionImpl(testSchema, "testGeometry");
        LineString geom = gf.createLineString(coords);
        LiteralExpressionImpl expr2 = new LiteralExpressionImpl(geom);
        Intersects intersects = fac.intersects(expr1, expr2);

        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue(intersects.evaluate(testFeature));
    
        intersects = fac.intersects(expr2, expr1);

        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue(intersects.evaluate(testFeature));

        Function function = new GeometryFunction(geom);
        intersects = fac.intersects(expr1, function);
        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue(intersects.evaluate(testFeature));
       

        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue( intersects.evaluate(testFeature) );
       
        coords[0] = new Coordinate(0, 0);
        coords[1] = new Coordinate(3, 0);
        coords[2] = new Coordinate(6, 0);
        expr2 = new LiteralExpressionImpl(gf.createLineString(coords));
        intersects = fac.intersects(expr1, expr2);

        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue(!intersects.evaluate(testFeature));

        expr2 = new LiteralExpressionImpl(null);
        intersects = fac.intersects(expr1, expr2);

        LOGGER.finer( intersects.toString());           
        LOGGER.finer( "contains feature: " + intersects.evaluate(testFeature));
        assertTrue(!intersects.evaluate(testFeature));
  }
View Full Code Here

    public void testIntersectsUnreferencedGeometry() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        assertEquals(original, clone);
    }
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
        ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326"));
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("line"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
       
        assertNotSame(original, clone);
        Intersects isClone = (Intersects) clone;
        assertEquals(isClone.getExpression1(), original.getExpression1());
        LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null);
        assertTrue(15 == clonedLs.getCoordinateN(0).x);
        assertTrue(10 == clonedLs.getCoordinateN(0).y);
        assertTrue(25 == clonedLs.getCoordinateN(1).x);
        assertTrue(20 == clonedLs.getCoordinateN(1).y);
        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
View Full Code Here

   
    public void testIntersectsWithFunction() throws Exception {
        Function function = new GeometryFunction();
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), function);
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        Intersects isClone = (Intersects) clone;
        assertEquals(isClone.getExpression1(), original.getExpression1());
        LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null);
        assertTrue(15 == clonedLs.getCoordinateN(0).x);
        assertTrue(10 == clonedLs.getCoordinateN(0).y);
        assertTrue(25 == clonedLs.getCoordinateN(1).x);
        assertTrue(20 == clonedLs.getCoordinateN(1).y);
        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
        ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326"));
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        Intersects isClone = (Intersects) clone;
        assertEquals(isClone.getExpression1(), original.getExpression1());
        LineString clonedLs = (LineString) ((Literal) isClone.getExpression2()).getValue();
        assertTrue(15 == clonedLs.getCoordinateN(0).x);
        assertTrue(10 == clonedLs.getCoordinateN(0).y);
        assertTrue(25 == clonedLs.getCoordinateN(1).x);
        assertTrue(20 == clonedLs.getCoordinateN(1).y);
        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
View Full Code Here

        SFSFilterVisitor visitor = new SFSFilterVisitor(true);
        /* Testing for point geometry*/
        GeometryFactory gf = new GeometryFactory();
        Point p = gf.createPoint(new Coordinate(100.1, 0.1));
       
        Intersects intr = FF.intersects(FF.property("Point"), FF.literal(p));
        visitor.visit(intr, null);
        visitor.finish(builder, false);
        assertEquals(URL_LAYER_ASIA + "?geometry={\"type\":\"Point\",\"coordinates\":[100.1,0.1]}", URLDecoder.decode(builder.toString(),"UTF-8"));
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.spatial.Intersects

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.