Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory2.intersects()


        caps.addName(BBOX.NAME);
        caps.addName(Crosses.NAME);

        final Geometry geom = new GeometryFactory().createPoint(new Coordinate(0, 0));
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        Filter intersects = ff.intersects(ff.property("geom"), ff.literal(geom));
        Filter bbox = ff.bbox(ff.property("geom"), 0, 0, 1, 1, "EPSG:4326");

        // if the filter is an Or we can't know
        Filter filter = ff.or(intersects, bbox);
        Filter[] splitted = strategy.splitFilters(caps, filter);
View Full Code Here


    // will result in a polygon matching the original click
    Polygon clickPolygon = JTS.toGeometry(bbox, null, 10);
    MathTransform transform = CRS.findMathTransform(worldCRS, targetCRS);
    Polygon polygon = (Polygon) JTS.transform(clickPolygon, transform);

    Filter filter = ff.intersects(ff.property(geometryPropertyName),
            ff.literal(polygon));

    return featureSource.getFeatures(filter);
}
View Full Code Here

    Polygon clickPolygon = JTS.toGeometry(bbox, null, 10);
    MathTransform transform = CRS.findMathTransform(worldCRS, targetCRS);
    Polygon polygon = (Polygon) JTS.transform(clickPolygon, transform);
   
    Filter filter1 = ff.bbox(ff.property(geometryPropertyName), bbox);
    Filter filter2 = ff.intersects(ff.property(geometryPropertyName), ff.literal(polygon));
   
    Filter filter = ff.and(filter1, filter2);
   
    return featureSource.getFeatures(filter);
}
View Full Code Here

            feature = it.next();
            BoundingBox bounds = feature.getBounds();
            boundsCheck = ff.bbox(ff.property("the_geom"), bounds);
           
            Geometry geom = (Geometry) feature.getDefaultGeometry();
            polyCheck = ff.intersects(ff.property("the_geom"), ff.literal(geom));
           
            andFil = ff.and(boundsCheck, polyCheck);
           
            try {
                fcResult = featureSource.getFeatures(andFil);
View Full Code Here

                Geometry geometry = (Geometry) feature.getDefaultGeometry();
                if (!geometry.isValid()) {
                    // skip bad data
                    continue;
                }
                Filter innerFilter = ff.intersects(ff.property(geomName2), ff.literal(geometry));
                Query innerQuery = new Query(typeName2, innerFilter, Query.NO_NAMES);
                SimpleFeatureCollection join = shapes2.getFeatures(innerQuery);
                int size = join.size();
                max = Math.max(max, size);
            } catch (Exception skipBadData) {
View Full Code Here

        Coordinate[] coordinates = { new Coordinate(39, -107), new Coordinate(38, -107),
                new Coordinate(38, -104), new Coordinate(39, -104), new Coordinate(39, -107) };
        LinearRing shell = gf.createLinearRing(coordinates);
        Polygon polygon = gf.createPolygon(shell, null);
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        Filter filter = ff.intersects(ff.property(defaultGeometryName), ff.literal(polygon));
        // System.out.println(filter);
        query.setFilter(filter);

        SimpleFeatureCollection features;
        features = featureSource.getFeatures(query);
View Full Code Here

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        // should match only "r1"
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LineString ls = gf.createLineString(sf.create(new double[] { 2, 1, 2, 3 }, 2));
        Intersects is = ff.intersects(ff.property(aname("geom")), ff.literal(ls));
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(is);
        checkSingleResult(features, "r1");
    }
   
    public void testIntersectsRingFilter() throws Exception {
View Full Code Here

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        // should match only "r1"
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LineString ls = gf.createLinearRing(sf.create(new double[] { 2, 1, 2, 3, 0, 3, 2, 1}, 2));
        Intersects is = ff.intersects(ff.property(aname("geom")), ff.literal(ls));
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(is);
        checkSingleResult(features, "r1");
    }
   
    public void testTouchesFilter() throws Exception {
View Full Code Here

        final Geometry geom = literal.evaluate(null, Geometry.class);
        final double distance = filter.getDistance();
        final Geometry buffer = geom.buffer(distance);

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        BinarySpatialOperator intersects = ff.intersects(property, ff.literal(buffer));

        addSpatialFilter(intersects, SeFilter.METHOD_II_OR_ET, truth, extraData);

        return extraData;
    }
View Full Code Here

        }

        private SimpleFeatureCollection filteredCollection(Geometry currentGeom,
                SimpleFeatureCollection subFeatureCollection) {
            FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
            Filter intersectFilter = ff.intersects(ff.property(dataGeomName), ff
                    .literal(currentGeom));
            SimpleFeatureCollection subFeatureCollectionIntersection = this.subFeatureCollection
                    .subCollection(intersectFilter);
            if (subFeatureCollectionIntersection.size() == 0) {
                subFeatureCollectionIntersection = subFeatureCollection;
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.