Package org.geotools.filter

Examples of org.geotools.filter.GeometryFilter


            fSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) layer.getFeatureSource();
            SimpleFeatureType schema = fSource.getSchema();

            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext.getAreaOfInterest());
                GeometryFilter bboxFilter = fFac.createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(fFac.createAttributeExpression(schema,
                        schema.getGeometryDescriptor().getName().getLocalPart()));
                bboxFilter.addRightGeometry(bboxExpression);

                Query bboxQuery = new DefaultQuery(schema.getTypeName(), bboxFilter);
                Query definitionQuery = layer.getQuery();
                DefaultQuery finalQuery = new DefaultQuery(DataUtilities.mixQueries(definitionQuery, bboxQuery, "svgEncoder"));
                finalQuery.setHints(definitionQuery.getHints());
View Full Code Here


            FeatureSource fSource = layer.getFeatureSource();
            FeatureType schema = fSource.getSchema();
            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext
                        .getAreaOfInterest());
                GeometryFilter bboxFilter = fFac.createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(bboxExpression);
                bboxFilter.addRightGeometry(fFac.createAttributeExpression(
                        schema, schema.getDefaultGeometry().getName()));
               
                Query bboxQuery = new DefaultQuery(schema.getTypeName(),
                        bboxFilter);
               
View Full Code Here

            //  within the filter.  The BBOX element is ambiguous, since
            //  features may contain multiple geometries.  For now, we will
            //  parse it and keep a record of a 'primary geometry' in the
            //  server.
            try {
                GeometryFilter finalFilter = factory.createGeometryFilter(AbstractFilter.GEOMETRY_INTERSECTS);

                //leave as null and postgisDatSource will use default geom.
                //AttributeExpression leftExpression =
                //    factory.createAttributeExpression(null);
                //leftExpression.setAttributePath("@");
                // Creates coordinates for the linear ring
                Coordinate[] coords = new Coordinate[5];
                coords[0] = new Coordinate(rawCoords[0], rawCoords[1]);
                coords[1] = new Coordinate(rawCoords[0], rawCoords[3]);
                coords[2] = new Coordinate(rawCoords[2], rawCoords[3]);
                coords[3] = new Coordinate(rawCoords[2], rawCoords[1]);
                coords[4] = new Coordinate(rawCoords[0], rawCoords[1]);

                LinearRing outerShell = new LinearRing(coords,
                        new PrecisionModel(), 0);
                Geometry polygon = new Polygon(outerShell,
                        new PrecisionModel(), 0);
                LiteralExpression rightExpression = factory
                    .createLiteralExpression(polygon);

                //finalFilter.addLeftGeometry(leftExpression);
                finalFilter.addRightGeometry(rightExpression);
                filters.add(finalFilter);

                return filters;
            } catch (IllegalFilterException e) {
                throw new WfsException("Filter creation problem: "
View Full Code Here

        Polygon pixelRect = geomFac.createPolygon(boundary, null);

        FilterFactory filterFac = FilterFactory.createFilterFactory();

        GeometryFilter getFInfoFilter = null;

        try {
            getFInfoFilter = filterFac.createGeometryFilter(AbstractFilter.GEOMETRY_INTERSECTS);
            getFInfoFilter.addLeftGeometry(filterFac.createLiteralExpression(
                    pixelRect));
        } catch (IllegalFilterException e) {
            e.printStackTrace();
            throw new WmsException(null, "Internal error : " + e.getMessage());
        }
View Full Code Here

     *
     * @throws IllegalFilterException For problems making the filter.
     */
    private Filter buildFilter(Envelope requestExtent, FilterFactory ffactory,
        FeatureType schema) throws IllegalFilterException {
        GeometryFilter bboxFilter;
        bboxFilter = ffactory.createGeometryFilter(AbstractFilter.GEOMETRY_INTERSECTS);

        BBoxExpression bboxExpr = ffactory.createBBoxExpression(requestExtent);
        Expression geomAttExpr = ffactory.createAttributeExpression(schema,
                schema.getDefaultGeometry().getName());
        bboxFilter.addLeftGeometry(geomAttExpr);
        bboxFilter.addRightGeometry(bboxExpr);

        return bboxFilter;
    }
View Full Code Here

        LockRequest baseRequest = new LockRequest();
        baseRequest.setVersion("1.0.0");
        baseRequest.setLockAll(true);

        // make base comparison objects
        GeometryFilter filter = factory.createGeometryFilter(AbstractFilter.GEOMETRY_WITHIN);
        //DJB changed this so it conforms to new FeatureType method
        AttributeExpression leftExpression = factory.createAttributeExpression((FeatureType)null,"location");
        //leftExpression.setAttributePath("location");

        // Creates coordinates for the linear ring
        Coordinate[] coords = new Coordinate[5];
        coords[0] = new Coordinate(10, 10);
        coords[1] = new Coordinate(10, 20);
        coords[2] = new Coordinate(20, 20);
        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);
        filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);
        baseRequest.addLock("rail", filter);
        baseRequest.addLock("roads", filter);

        //        baseRequest.addFilter(filter);
        //baseRequest.addFilter(filter);
View Full Code Here

        DeleteRequest internalRequest1 = new DeleteRequest();
        internalRequest1.setTypeName("rail");

        //baseRequest.setReleaseAction(true);
        // make base comparison objects
        GeometryFilter filter = factory.createGeometryFilter(AbstractFilter.GEOMETRY_WITHIN);
        AttributeExpression leftExpression = factory.createAttributeExpression((AttributeType)null);
        leftExpression.setAttributePath("location");

        // Creates coordinates for the linear ring
        Coordinate[] coords = new Coordinate[5];
        coords[0] = new Coordinate(10, 10);
        coords[1] = new Coordinate(10, 20);
        coords[2] = new Coordinate(20, 20);
        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);
        filter.addLeftGeometry(leftExpression);
        filter.addRightGeometry(rightExpression);

        internalRequest1.setFilter(filter);

        DeleteRequest internalRequest2 = new DeleteRequest();
        internalRequest2.setTypeName("roads");
View Full Code Here

        DeleteRequest internalRequest1 = new DeleteRequest();
        internalRequest1.setTypeName("rail");

        // make base comparison objects
        GeometryFilter filter = factory.createGeometryFilter(AbstractFilter.GEOMETRY_BBOX);

        // Creates coordinates for the linear ring
        Coordinate[] coords = new Coordinate[5];
        coords[0] = new Coordinate(10, 10);
        coords[1] = new Coordinate(10, 20);
        coords[2] = new Coordinate(20, 20);
        coords[3] = new Coordinate(20, 10);
        coords[4] = new Coordinate(10, 10);

        LinearRing outerShell = new LinearRing(coords, new PrecisionModel(), 0);
        Polygon polygon = new Polygon(outerShell, new PrecisionModel(), 0);
        LiteralExpression rightExpression = factory.createLiteralExpression(polygon);
        filter.addRightGeometry(rightExpression);

        internalRequest1.setFilter(filter);
        baseRequest.addSubRequest(internalRequest1);

        // run test      
View Full Code Here

            FeatureType schema = fSource.getSchema();

            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext
                        .getAreaOfInterest());
                GeometryFilter bboxFilter = fFac.createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(bboxExpression);
                bboxFilter.addRightGeometry(fFac.createAttributeExpression(
                        schema, schema.getDefaultGeometry().getName()));

                Query bboxQuery = new DefaultQuery(schema.getTypeName(),
                        bboxFilter);
View Full Code Here

            SimpleFeatureType schema = fSource.getSchema();

            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext
                        .getAreaOfInterest());
                GeometryFilter bboxFilter = fFac
                        .createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(fFac.createAttributeExpression(schema, schema
                        .getGeometryDescriptor().getName().getLocalPart()));
                bboxFilter.addRightGeometry(bboxExpression);

                Query bboxQuery = new Query(schema.getTypeName(), bboxFilter);
                Query definitionQuery = layer.getQuery();
                Query finalQuery = new Query(DataUtilities.mixQueries(definitionQuery, bboxQuery,
                        "svgEncoder"));
View Full Code Here

TOP

Related Classes of org.geotools.filter.GeometryFilter

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.