Examples of DWithin


Examples of org.opengis.filter.spatial.DWithin

        assertEquals("WHERE SDO_WITHIN_DISTANCE(\"GEOM\",?,'distance=10.0 unit=km') = 'TRUE' ", encoded);
    }
   
    public void testDWithinFilterWithoutUnit() throws Exception {
        Coordinate coordinate = new Coordinate();
        DWithin dwithin = ff.dwithin(ff.property("GEOM"), ff.literal(gf.createPoint(coordinate)), 10.0, null);
        String encoded = encoder.encodeToString(dwithin);
        assertEquals("WHERE SDO_WITHIN_DISTANCE(\"GEOM\",?,'distance=10.0') = 'TRUE' ", encoded);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

        PropertyName geomName = ff.property(aname("geo"));
        Literal lit = ff.literal(geometry);
       
        DWithin dwithinGeomFilter  = ((FilterFactory2) ff).dwithin(geomName, lit, distance, unit);
        Query query = new Query(tname("geopoint"), dwithinGeomFilter);
        SimpleFeatureCollection features = dataStore.getFeatureSource(tname("geopoint")).getFeatures(query);
        assertEquals(1, features.size());
        checkSingleResult(features, "Town");
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        coords2[4] = new Coordinate(10, 10);

        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal right = fac.literal(gf.createPolygon(
                    gf.createLinearRing(coords2), null));
        DWithin filter = fac.dwithin(fac.property("testGeometry"), right, 10, "m");

        assertAttributeName(filter, "testGeometry");
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        init("not-active");
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        Point ls = gf.createPoint(sf.create(new double[] { 1, 1 }, 2));
        DWithin f = ff.dwithin(ff.property("geo"), ff.literal(ls), 3, SI.METRE.getSymbol());
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(2, features.size());
        SimpleFeatureIterator fsi = features.features();
        assertTrue(fsi.hasNext());
        assertEquals(fsi.next().getID(), "not-active.12");
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

    }
   
    public void testDWithin() throws Exception {
        Filter test = parseDocument("dwithin.xml");
        assertTrue(test instanceof DWithin);
        DWithin dw = (DWithin) test;
        assertEquals("the_geom", ((PropertyName) dw.getExpression1()).getPropertyName());
        assertTrue(((Literal) dw.getExpression2()).getValue() instanceof Point);
        assertEquals(5000.0, dw.getDistance());
        assertEquals("metre", dw.getDistanceUnits());
        LOGGER.fine("parsed filter is " + test);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

    }
   
    public void testDWithinQualified() throws Exception {
        Filter test = parseDocument("dwithin-qualified.xml");
        assertTrue(test instanceof DWithin);
        DWithin dw = (DWithin) test;
        assertEquals("the_geom", ((PropertyName) dw.getExpression1()).getPropertyName());
        assertTrue(((Literal) dw.getExpression2()).getValue() instanceof Point);
        assertEquals(5000.0, dw.getDistance());
        assertEquals("metre", dw.getDistanceUnits());
        LOGGER.fine("parsed filter is " + test);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        coords2[4] = new Coordinate(10, 10);
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal right = new LiteralExpressionImpl(gf.createPolygon(gf.createLinearRing(
                coords2),null));
       
        DWithin filter = fac.dwithin(left, right, 20, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));

        filter = fac.dwithin(left, right, 2, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));
       
        right = new LiteralExpressionImpl(null);
        filter = fac.dwithin(left, right, 2, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

                return ReprojectingFilterVisitor.super.visit((DWithin) filter, extraData);
            }

            Object cloneFilter(BinarySpatialOperator bso, Object extraData, Expression ex1,
                    Expression ex2) {
                DWithin filter = (DWithin) bso;
                return ff.dwithin(ex1, ex2, filter.getDistance(), filter.getDistanceUnits());
            }
        }.transform(filter, extraData);
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        // gc.setDestinationGeographicPoint(1, 49);
        // System.out.println(gc.getOrthodromicDistance()); --> 73171 m (we round to 74000)

        // if the proper distance is used, we get back only one point,
        // otherwise we'll get back them all
        DWithin filter = ff.dwithin(ff.property(aname("geo")), ff.literal(gf
                .createPoint(new Coordinate(1, 49))), 74000d, "metre");
        FeatureCollection features = dataStore.getFeatureSource(tname("geopoint")).getFeatures(
                filter);
        assertEquals(1, features.size());
    }
View Full Code Here

Examples of org.opengis.filter.spatial.DWithin

        fw.close();

        // testing distance filter
        LineString line = gf.createLineString(new Coordinate[] { new Coordinate(-122.33, 47.606),
                new Coordinate(0.0, 51.5) });
        DWithin filter = ff.dwithin(ff.property(aname("geo")), ff.literal(line), 130000d, "metre");
        FeatureCollection features = dataStore.getFeatureSource(tname("geopoint")).getFeatures(
                filter);
        assertEquals(1, features.size());
        FeatureIterator fi = features.features();
        assertTrue(fi.hasNext());
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.